//================================= // Created on: 2018/11/09 21:26:57 //================================= #include int main() { using ll = long long; int N1; std::cin >> N1; ll si = 1, bo = 1; for (int i = 0, a; i < N1; i++) { std::cin >> a; (i == 0 ? si : bo) *= a; } int N2; std::cin >> N2; for (int i = 0, a; i < N2; i++) { std::cin >> a; (i % 2 == 0 ? bo : si) *= a; } const ll g = std::gcd(bo, si); bo /= g, si /= g; if (bo < 0) { bo *= -1, si *= -1; } std::cout << si << " " << bo << std::endl; return 0; }