# Function: crt
# ---------------
# Finds the solution modulo (m_1 * m_2 ... * m_k) to the system of equations x = a_1 (mod m_1), x = a_2 (mod m_2), ..., x = a_k (mod m_k) where m_1, m_2, ... m_k are all relatively prime
# Takes in a list of tuples (a_i, m_i) and returns the value of x

def crt():