from fractions import gcd

l=1

for _ in[0]*int(eval(input())):

    t=int(eval(input()))

    l=l*t//gcd(l,t)

print(l)
l=1

for _ in[0]*int(eval(input())):

    t=int(eval(input()))

    a,b=l,t

    while b:

        a,b=b,a%b

    l*=t//a

print(l)
from fractions import gcd

l = 1
for _ in [0] * int(eval(input())):
    t = int(eval(input()))
    l = l * t // gcd(l, t)
print(l)

l = 1
for _ in [0] * int(eval(input())):
    t = int(eval(input()))
    a, b = l, t
    while b:
        a, b = b, a % b
    l *= t // a
print(l)

-from fractions import gcd - -    l = l * t // gcd(l, t) +    a, b = l, t +    while b: +        a, b = b, a % b +    l *= t // a