AtCoder Beginner Contest 070 - Multiple Clocks

We have N clocks. The hand of the i-th clock (1≤i≤N) rotates through 360° in exactly T_i seconds.

Initially, the hand of every clock stands still, pointing directly upward.

Now, Dolphin starts all the clocks simultaneously.

In how many seconds will the hand of every clock point directly upward again?

-----Constraints-----
 - 1≤N≤100 
 - 1≤T_i≤10^{18} 
 - All input values are integers.  
 - The correct answer is at most 10^{18} seconds.

-----Input-----
Input is given from Standard Input in the following format:  
N
T_1
:  
T_N

-----Output-----
Print the number of seconds after which the hand of every clock point directly upward again.

-----Sample Input-----
2
2
3

-----Sample Output-----
6

We have two clocks. The time when the hand of each clock points upward is as follows:
 - Clock 1: 2, 4, 6, ... seconds after the beginning
 - Clock 2: 3, 6, 9, ... seconds after the beginning
Therefore, it takes 6 seconds until the hands of both clocks point directly upward.

Difficulty: EASY

Starter code:

Solutions:
import math

def lcm(x, y):
	return x * y // math.gcd(x, y)
n = int(input())
t = [int(input()) for _ in range(n)]
ans = 1
for i in t:
	ans = lcm(i, ans)
print(ans)


from fractions import gcd
n = int(input())
a = [int(input()) for i in range(n)]
tmp = 1
for i in a:
	tmp = tmp * i // gcd(tmp, i)
print(tmp)


import math
n = int(input())
ans = 1
for _ in range(n):
	t1 = int(input())
	ans = ans // math.gcd(ans, t1) * t1
print(ans)


import fractions
n = int(input())
t = []
for _ in range(n):
	T = int(input())
	t.append(T)
ans = t[0]
for i in range(1, len(t)):
	ans = ans * t[i] // fractions.gcd(ans, t[i])
print(ans)


from fractions import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
ans = 1
for i in range(n):
	t = int(input())
	ans = lcm(ans, t)
print(ans)


n = int(input())
lcm = 1
import fractions
for i in range(n):
	t = int(input())
	lcm = t * lcm // fractions.gcd(t, lcm)
print(lcm)


import fractions
N = int(input())
ans = 1
for i in range(N):
	T = int(input())
	ans = T * ans // fractions.gcd(T, ans)
print(ans)


from fractions import gcd
n = int(input())
res = int(input())
for i in range(n - 1):
	w = int(input())
	res = res * w // gcd(res, w)
print(res)


n = int(input())
t = [int(input()) for _ in range(n)]
import math
from functools import reduce

def lcm_base(x, y):
	return x * y // math.gcd(x, y)

def lcm(*numbers):
	return reduce(lcm_base, numbers, 1)
print(lcm(*t))


from math import gcd
n = int(input())
t = [int(input()) for i in range(n)]
ans = 1
for i in range(n):
	ans = ans * t[i] // gcd(ans, t[i])
print(ans)


(_, a, *l) = map(int, open(0).read().split())
for i in l:
	(x, y) = (a, i)
	while y:
		(x, y) = (y, x % y)
	a *= i // x
print(a)


import fractions
n = int(input())
t = [int(input()) for _ in [0] * n]
d = t[0]
for i in range(1, n):
	d = t[i] * d // fractions.gcd(t[i], d)
print(d)


from fractions import gcd
a = int(input())
s = int(input())
k = s
for i in range(a - 1):
	d = int(input())
	k = k * d // gcd(k, d)
print(k)


N = int(input())
T = list((int(input()) for _ in range(N)))

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
ans = T[0]
for i in range(1, N):
	ans = ans * T[i] // gcd(ans, T[i])
print(ans)


import fractions
N = int(input())
T = [int(input()) for i in range(N)]
lcm = 1
for t in T:
	lcm = lcm * t // fractions.gcd(lcm, t)
print(lcm)


import math

def lcm(a, b):
	return a * b // math.gcd(a, b)
N = int(input())
ans = int(input())
for _ in range(N - 1):
	ans = lcm(ans, int(input()))
print(ans)


import math
N = int(input())
g = int(input())
for _ in range(N - 1):
	T = int(input())
	g = g * T // math.gcd(g, T)
print(g)


import math
from functools import reduce

def lcm_base(x, y):
	return x * y // math.gcd(x, y)

def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
n = int(input())
nums = [int(input()) for i in range(n)]
print(lcm_list(nums))


def euclid(a, b):
	if b == 0:
		return a
	else:
		return euclid(b, a % b)

def multiple(a, b):
	return a * b // euclid(a, b)
import functools

def lcm(nums):
	return functools.reduce(multiple, nums)
a = []
n = int(input())
for i in range(n):
	a.append(int(input()))
print(lcm(a))


from math import gcd
n = int(input())
ans = 1
for _ in range(n):
	t = int(input())
	ans = ans * t // gcd(ans, t)
else:
	print(ans)


from math import gcd
from functools import reduce
f = lambda x, y: x * y // gcd(x, y)
print(reduce(f, [int(input()) for _ in range(int(input()))]))


import fractions
ans = 1
n = int(input())
for i in range(n):
	a = int(input())
	ans = a * ans // fractions.gcd(a, ans)
print(ans)


from fractions import gcd
N = int(input())
T = [int(input()) for _ in range(N)]
ans = T[0]
for t in T:
	a = gcd(ans, t)
	ans *= t // a
print(ans)


import fractions
N = int(input())
S_t = 1
for i in range(N):
	t = int(input())
	S_t = S_t * t // fractions.gcd(S_t, t)
print(S_t)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
ans = 1
for i in range(int(input())):
	h = int(input())
	ans = ans * h // gcd(ans, h)
print(ans)


N = int(input())
T = [int(input()) for _ in range(N)]
import math
from functools import reduce
print(reduce(lambda x, y: x * y // math.gcd(x, y), T, 1))


import fractions as f
n = int(input())
ans = int(input())
for i in range(n - 1):
	x = int(input())
	ans = x * ans // f.gcd(ans, x)
print(ans)


from fractions import gcd
from functools import reduce
n = int(input())
g = 1
for i in range(n):
	t = int(input())
	g = g * t // gcd(g, t)
print(g)


import fractions
n = int(input())
gcm = 1
for i in [int(input()) for _ in range(n)]:
	gcm = gcm * i // fractions.gcd(gcm, i)
print(gcm)


from math import gcd
n = int(input())
l = 1
for _ in range(n):
	t = int(input())
	l = l // gcd(l, t) * t
print(l)


from fractions import gcd
N = int(input())
ts = [int(input()) for i in range(N)]
lcm = 1
for t in ts:
	lcm = lcm * t // gcd(lcm, t)
print(lcm)


import numpy as np
n = int(input())
lis = []
for i in range(n):
	lis.append(int(input()))
print(np.lcm.reduce(lis))


import math

def lcm(a, b):
	return a * b // math.gcd(a, b)
n = int(input())
if n == 1:
	print(input())
elif n == 2:
	a = int(input())
	b = int(input())
	print(lcm(a, b))
else:
	a = int(input())
	b = int(input())
	ans = lcm(a, b)
	for _ in range(n - 2):
		i = int(input())
		ans = lcm(ans, i)
	print(ans)


from math import gcd
N = int(input())
T = list((int(input()) for _ in range(N)))
ans = T[0]
for i in range(1, N):
	ans = ans * T[i] // gcd(ans, T[i])
print(ans)


from fractions import gcd
n = int(input())
lis = [int(input()) for _ in range(n)]
x = lis[0]
for i in lis[1:]:
	x = x * i // gcd(x, i)
print(x)


import math
from functools import reduce

def lcm_base(x, y):
	return x * y // math.gcd(x, y)

def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
n = int(input())
l = []
for i in range(n):
	t = int(input())
	l.append(t)
print(lcm_list(l))


import math
N = int(input())
lsT = []
for i in range(N):
	lsT.append(int(input()))
a = lsT[0]
for b in range(1, N):
	a = a * lsT[b] // math.gcd(a, lsT[b])
print(a)


import fractions
import functools
lcm = lambda x, y: x * y // fractions.gcd(x, y)
print(functools.reduce(lcm, [int(input()) for _ in [0] * int(input())]))


import math
from functools import reduce
url = 'https://atcoder.jp//contests/abc070/tasks/abc070_c'

def lcm_base(x, y):
	return x * y // math.gcd(x, y)

def lcm(*numbers):
	return reduce(lcm_base, numbers, 1)

def main():
	count = int(input())
	clocks = []
	for i in range(count):
		clocks.append(int(input()))
	print(lcm(*clocks))

def __starting_point():
	main()
__starting_point()


import fractions
n = int(input())
a = 1
for b in range(n):
	b = int(input())
	a = a * b // fractions.gcd(a, b)
print(a)


import fractions
n = int(input())
t = set([int(input()) for _ in range(n)])
ans = 1
for i in t:
	ans = i * ans // fractions.gcd(i, ans)
print(ans)


from math import *

def lcm(x, y):
	return x * y // gcd(x, y)
N = int(input())
T = [int(input()) for _ in range(N)]
ans = T[0]
for i in range(1, N):
	ans = lcm(ans, T[i])
print(ans)


def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)
n = int(input())
x = []
for i in range(n):
	x.append(int(input()))
l = x[0]
for i in range(1, n):
	l = lcm(l, x[i])
print(l)


def gcd(m, n):
	if m < n:
		(m, n) = (n, m)
	while True:
		r = m % n
		if r == 0:
			return n
		else:
			(m, n) = (n, r)

def lcm(m, n):
	return m * n // gcd(m, n)
n = int(input())
l = []
ans = 1
for i in range(n):
	t = int(input())
	ans = lcm(ans, t)
print(ans)


import fractions
N = int(input())
T = [int(input()) for i in range(N)]
a = T[0]
for i in range(N):
	a = a * T[i] // fractions.gcd(a, T[i])
print(a)


from math import gcd
n = int(input())
ans = int(input())
for _ in range(n - 1):
	x = int(input())
	ans = ans * x // gcd(ans, x)
print(ans)


import fractions
n = int(input())
t = [int(input()) for i in range(n)]
gc = t[0]
for i in range(n):
	gc = gc * t[i] // fractions.gcd(gc, t[i])
print(gc)


from fractions import gcd
from functools import reduce
lcm = lambda x, y: x * y // gcd(x, y)
(N, *T) = map(int, open(0))
print(reduce(lcm, T))


n = int(input())
a = []
for i in range(n):
	a.append(int(input()))

def gcd(x, y):
	while y != 0:
		(x, y) = (y, x % y)
	return x
res = a[0]
for i in range(n):
	res = res * a[i] // gcd(res, a[i])
print(res)


from fractions import gcd
N = int(input())
T = 1
for i in range(N):
	T1 = int(input())
	t = gcd(T, T1)
	T = T1 // t * (T // t) * t
print(T)


import math
a = [int(input()) for _ in range(int(input()))]
r = a[0]
for i in range(len(a)):
	r = r * a[i] // math.gcd(r, a[i])
print(r)


import math
from functools import reduce

def lcm_base(x, y):
	return x * y // math.gcd(x, y)

def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
N = int(input())
N_List = []
for i in range(N):
	N_List.append(int(input()))
print(lcm_list(N_List))


import fractions as math
a = int(input())
c = 1
for i in range(a):
	b = int(input())
	c = b * c // math.gcd(b, c)
print(c)


def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)
N = int(input())
T = [int(input()) for _ in range(N)]
ans = 1
for t in T:
	ans = lcm(ans, t)
print(ans)


from math import gcd
N = int(input())
res = 1
for _ in range(N):
	T = int(input())
	res = res * T // gcd(res, T)
print(res)


from fractions import gcd
n = int(input())
ans = int(input())
for i in range(n - 1):
	ne = int(input())
	ans = ans * ne // gcd(ans, ne)
print(ans)


n = int(input())
T = [int(input()) for _ in range(n)]

def gcd(a, b):
	if a > b:
		(a, b) = (b, a)
	while a % b != 0:
		(a, b) = (b, a % b)
	return b

def lcm(a, b):
	return a * b // gcd(a, b)
l = T.pop()
for t in T:
	l = lcm(l, t)
print(l)


import os
import sys

def gcd(a, b):
	while a % b != 0:
		r = a % b
		a = b
		b = r
	return b

def main():
	n = int(input())
	ans = int(input())
	for _ in range(n - 1):
		t = int(input())
		ans = ans * t // gcd(max(ans, t), min(ans, t))
	print(ans)

def __starting_point():
	main()
__starting_point()


from fractions import gcd
a = 1
for i in range(int(input())):
	h = int(input())
	a = a * h // gcd(a, h)
print(a)


from fractions import gcd
n = int(input())
l = 1
for _ in range(n):
	tmp = int(input())
	l = tmp * l // gcd(tmp, l)
print(l)


import math
N = int(input())
T = [int(input()) for _ in range(N)]
ans = T[0]
for i in range(1, N):
	ans = ans * T[i] // math.gcd(ans, T[i])
	ans %= 10 ** 18 + 7
print(ans)


from fractions import gcd
n = int(input())
x = 1
for i in range(n):
	t = int(input())
	g = gcd(t, x)
	t //= g
	x *= t
print(x)


import math
from functools import reduce

def lcm_base(x, y):
	return x * y // math.gcd(x, y)

def lcm(*numbers):
	return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
N = int(input())
AA = [int(input()) for i in range(N)]
print(lcm(*AA))


from fractions import gcd
n = int(input())
ans = int(input())
for _ in range(n - 1):
	t = int(input())
	ans = ans * t // gcd(ans, t)
print(ans)


import math
from functools import reduce
n = int(input())
tt = [int(input()) for i in range(n)]
x = 1

def lcm_base(x, y):
	return x * y // math.gcd(x, y)

def lcm(*numbers):
	return reduce(lcm_base, numbers, 1)
print(lcm(*tt))


import fractions
N = int(input())
ans = 1
for _ in range(N):
	t = int(input())
	ans = ans * t // fractions.gcd(ans, t)
print(ans)


from fractions import gcd
N = int(input())
a = int(input())
for i in range(N - 1):
	b = int(input())
	a = a * b // gcd(a, b)
print(int(a))


import math
n = int(input())
tl = list((int(input()) for _ in range(n)))
if n == 1:
	print(tl[0])
else:
	ans = tl[0]
	for i in range(1, n):
		ans = ans // math.gcd(ans, tl[i]) * tl[i]
	print(ans)


from math import gcd
N = int(input())

def lcm(a, b):
	return a * b // gcd(a, b)
T1 = int(input())
ans = T1
for i in range(N - 1):
	T2 = int(input())
	ans = lcm(ans, T2)
	T1 = T2
print(ans)


import math
from functools import reduce
N = int(input())
T = [int(input()) for _ in range(N)]

def lcm_base(x, y):
	return x * y // math.gcd(x, y)

def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
print(lcm_list(T))


import fractions
n = int(input())
ary = [int(input()) for _ in range(n)]
ans = 1
for i in ary:
	ans = ans * i // fractions.gcd(ans, i)
print(ans)


(_, a, *l) = map(int, open(0))
from fractions import *
for i in l:
	a *= i // gcd(a, i)
print(a)


import math
N = int(input())
P = [int(input()) for _ in range(N)]
a = 1
for p in P:
	g = math.gcd(a, p)
	a = a * p // g
print(a)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
ans = 1
for i in range(n):
	ans = lcm(ans, int(input()))
print(ans)


from fractions import gcd
n = int(input())
s = 1
for i in range(n):
	t = int(input())
	s = s * t // gcd(s, t)
print(s)


import fractions
n = int(input())
a = 1
for _ in range(n):
	x = int(input())
	a = a * x // fractions.gcd(a, x)
print(a)


import math
a = 1
n = int(input())
for i in range(n):
	t = int(input())
	a = a * t // math.gcd(a, t)
print(a)


import math

def lcm(x, y):
	return x * y // math.gcd(x, y)
N = int(input())
a = int(input())
for i in range(N - 1):
	a = lcm(a, int(input()))
print(a)


N = int(input())
ti = [int(input()) for i in range(N)]

def euc_alg(val1, val2):
	if val1 == val2:
		return val1
	mod = min(val1, val2)
	divided = max(val1, val2)
	while 1:
		tmp_mod = divided % mod
		if tmp_mod == 0:
			break
		divided = mod
		mod = tmp_mod
	ret = val1 * val2 // mod
	return ret
maxti = max(ti)
ans = ti[0]
for t in ti:
	ans = euc_alg(ans, t)
print(ans)


N = int(input())
T = [int(input()) for i in range(N)]
import math
a = T[0]
for i in range(1, N):
	a = a * T[i] // math.gcd(a, T[i])
print(a)


import math
import functools

def lcm(x, y):
	return x * y // math.gcd(x, y)
n = int(input())
t = [int(input()) for i in range(n)]
a = functools.reduce(math.gcd, t)
print(functools.reduce(lcm, t))


import math

def lcm(x, y):
	return x * y // math.gcd(x, y)

def main():
	n = int(input())
	t_lst = [int(input()) for _ in range(n)]
	t_lst.sort()
	answer = t_lst[0]
	for i in range(1, n):
		t = t_lst[i]
		answer = lcm(answer, t)
	print(answer)

def __starting_point():
	main()
__starting_point()


import math
(N, A, *T) = map(int, open(0))
for t in T:
	A *= t // math.gcd(A, t)
print(A)


N = int(input())
T = [int(input()) for _ in range(N)]

def gcd(a, b):
	if a % b == 0:
		return b
	return gcd(b, a % b)
res = T[0]
for t in T:
	gcd_ = gcd(res, t)
	res = res * t // gcd_
print(res)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	g = gcd(a, b)
	return a // g * b
N = int(input())
T = [int(input()) for _ in range(N)]
ans = 1
for i in range(N):
	ans = lcm(ans, T[i])
print(ans)


import fractions

def lcm(a, b):
	return a * b // fractions.gcd(a, b)
N = int(input())
T = 1
for i in range(N):
	T = lcm(T, int(input()))
print(T)


from math import gcd
from functools import reduce

def lcm(a, b):
	return a * b // gcd(a, b)

def main():
	n = int(input())
	t = [int(input()) for _ in range(n)]
	print(reduce(lcm, t))

def __starting_point():
	main()
__starting_point()


from fractions import gcd
from functools import reduce
(n, *T) = map(int, open(0).read().split())
print(reduce(lambda x, y: x * y // gcd(x, y), T))


def lcm(m, n):
	return m // gcd(m, n) * n

def gcd(m, n):
	r = m % n
	return gcd(n, r) if r else n
n = int(input())
arr = [int(input()) for _ in range(n)]
ans = 1
for i in arr:
	ans = lcm(ans, i)
print(ans)


import numpy as np
with open(0) as f:
	(N, *T) = map(int, f.read().split())
ans = 1
for t in T:
	ans = np.lcm(ans, t)
print(ans)


from fractions import gcd
n = int(input())
g = int(input())
for _ in range(n - 1):
	a = int(input())
	g = a * g // gcd(a, g)
print(g)


from fractions import gcd
n = int(input())
lcm = 1
for i in range(n):
	x = int(input())
	lcm = lcm * x // gcd(lcm, x)
print(lcm)


import sys
import math
pin = sys.stdin.readline

def main():
	N = int(pin())
	ans = int(pin())
	for i in range(N - 1):
		T = int(pin())
		ans = ans * T // math.gcd(ans, T)
	print(ans)
	return
main()


N = int(input())
T = [int(input()) for _ in range(N)]

def gcd(a, b):
	l = max(a, b)
	s = min(a, b)
	while True:
		x = s
		y = l % s
		if y == 0:
			break
		else:
			l = x
			s = y
	return s
if N != 1:
	ans = T[0] * T[1] // gcd(T[0], T[1])
	for n in range(1, N):
		ans = ans * T[n] // gcd(ans, T[n])
else:
	ans = T[0]
print(ans)


from fractions import gcd
N = int(input())
ans = 1
for i in [int(input()) for _ in range(N)]:
	ans = ans * i // gcd(ans, i)
print(ans)


n = int(input())
a = int(input())
import math
if n == 1:
	print(a)
	return
b = int(input())
c = a * b // math.gcd(a, b)
for i in range(n - 2):
	b = int(input())
	c = c * b // math.gcd(c, b)
print(c)


import math
N = int(input())
lcm = int(input())
for i in range(N - 1):
	x = int(input())
	lcm = lcm * x // math.gcd(lcm, x)
print(lcm)


from fractions import gcd
(n, *t) = map(int, open(0).read().split())
ans = t[0]
for i in range(1, n):
	ans = ans * t[i] // gcd(ans, t[i])
print(ans)


from math import gcd
n = int(input())
a = int(input())
for i in range(n - 1):
	b = int(input())
	g = gcd(a, b)
	a = a * b // g
print(a)


import fractions
A = int(input())
ans = int(input())
for i in range(A - 1):
	B = int(input())
	ans = B * ans // fractions.gcd(ans, B)
print(ans)


import fractions

def lcm(x, y):
	return x * y // fractions.gcd(x, y)
pg = 1
for i in range(int(input())):
	pg = lcm(pg, int(input()))
print(pg)


import math
num = 1
for i in range(int(input())):
	a = int(input())
	cnt = math.gcd(a, num)
	num = a * num // cnt
print(num)


from fractions import gcd
a = 1
for n in range(int(input())):
	T = int(input())
	a = a * T // gcd(a, T)
print(a)


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)
N = int(input())
T = []
total = 1
for i in range(N):
	a = int(input())
	T.append(a)
T_set = sorted(list(set(T)))
M = len(T_set)
ans = T_set[0]
if M == 1:
	ans = T_set[0]
else:
	for i in range(1, M):
		ans = lcm(ans, T_set[i])
print(ans)


from math import gcd
N = int(input())
ans = int(input())
for _ in range(N - 1):
	t = int(input())
	ans = t * ans // gcd(ans, t)
print(ans)


from math import gcd
n = int(input())
a = int(input())
for _ in range(n - 1):
	i = int(input())
	a = a * i // gcd(a, i)
print(a)


from functools import reduce
from fractions import gcd
N = int(input())
T = list((int(input()) for _ in range(N)))

def lcm_base(x, y):
	return x * y // gcd(x, y)

def lcm(numbers):
	return reduce(lcm_base, numbers, 1)
print(lcm(T))


from fractions import gcd
import io
data = int(input())
ans = 1
for _ in range(data):
	t = int(input())
	ans = t * ans // gcd(t, ans)
print(ans)


from math import gcd
n = int(input())
t = [int(input()) for _ in range(n)]
lcm = t[0]
for i in range(1, n):
	lcm = lcm * t[i] // gcd(lcm, t[i])
print(lcm)


from math import gcd
N = int(input())
T = [int(input()) for i in range(N)]
ans = 1
for i in range(N):
	ans = ans * T[i] // gcd(ans, T[i])
print(ans)


import math
N = int(input())
T = []
for i in range(N):
	T.append(int(input()))
ans = T[0]
for i in range(1, N):
	ans = ans * T[i] // math.gcd(ans, T[i])
print(ans)


from fractions import *
(_, *t) = map(int, open(0))
l = 1
for a in t:
	l = l * a // gcd(l, a)
print(l)


import fractions
n = int(input())
a = [int(input()) for i in range(n)]
p = a[0]
for x in a:
	p = p * x // fractions.gcd(p, x)
print(p)


from math import gcd
n = int(input())
lc = int(input())
for i in range(n - 1):
	t = int(input())
	gc = gcd(lc, t)
	lc = t * lc // gc
print(lc)


from fractions import gcd
N = int(input())
p = int(input())
for _ in range(N - 1):
	q = int(input())
	g = gcd(p, q)
	p = p * q // g
print(p)


from fractions import gcd
N = int(input())
cnt = 0
tmp = 1
for _ in range(N):
	t = int(input())
	tmp = tmp * t // gcd(tmp, t)
print(tmp)


import math
from math import gcd, pi, sqrt
INF = float('inf')
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

def i_map():
	return list(map(int, input().split()))

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def main():
	n = i_input()
	t = i_input()
	for i in range(n - 1):
		k = i_input()
		t = t * k // gcd(t, k)
	print(t)

def __starting_point():
	main()
__starting_point()


from math import gcd
n = int(input())
T = [int(input()) for _ in range(n)]
ans = 1
for i in range(n):
	ans = ans * T[i] // gcd(ans, T[i])
print(ans)


from math import gcd
N = int(input())
all_t = []
gcd_all = 0
if N >= 2:
	for i in range(N):
		all_t.append(int(input()))
		if i == 1:
			gcd_all = gcd(all_t[0], all_t[1])
			base = int(all_t[0] * all_t[1] // gcd_all)
		elif i >= 2:
			gcd_all = gcd(base, all_t[i])
			base = int(base * all_t[i] // gcd_all)
	print(base)
else:
	print(int(input()))


import fractions
n = int(input())
ans = 1
for _ in range(n):
	num = int(input())
	ans = ans * num // fractions.gcd(ans, num)
print(ans)


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


n = int(input())
from fractions import gcd
g = int(input())
for i in range(n - 1):
	h = int(input())
	g = g * h // gcd(g, h)
print(g)


import math

def lcm(a, b):
	return a * b // math.gcd(a, b)
N = int(input())
s = 1
for i in range(N):
	n = int(input())
	s = lcm(s, n)
print(s)


import math

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(x, y):
	return x * y // gcd(x, y)
N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
	print(T[0])
	return
ans = lcm(T[0], T[1])
for i in range(2, N):
	ans = lcm(T[i], ans)
print(ans)


from math import gcd
from functools import reduce

def lcm(x, y):
	return x * y // gcd(x, y)
N = int(input())
TS = [int(input()) for _ in range(N)]
print(reduce(lcm, TS))


import sys
from io import StringIO
import unittest
import math
from functools import reduce

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '2\n2\n3'
		output = '6'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '5\n2\n5\n10\n1000000000000000000\n1000000000000000000'
		output = '1000000000000000000'
		self.assertIO(input, output)

def resolve():
	N = int(input())
	T = [int(input()) for _ in range(N)]
	print(lcmlist(T))

def lcm(x, y):
	return x * y // math.gcd(x, y)

def lcmlist(l):
	return reduce(lcm, l)

def __starting_point():
	resolve()
__starting_point()


import math
n = int(input())
t = list((int(input()) for i in range(n)))
s = t[0]
for i in range(1, n):
	s = s * t[i] // math.gcd(s, t[i])
print(s)


import functools
import math
N = int(input())
T = [int(input()) for _ in range(N)]

def lcm(a, b):
	LCM = a * b // math.gcd(a, b)
	return LCM

def all_lcm(A):
	ans = functools.reduce(lcm, A, 1)
	return ans
print(all_lcm(T))


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


from math import gcd
from itertools import combinations, permutations, accumulate, product
from collections import deque, defaultdict, Counter
import decimal
import re
import math
import bisect
import heapq
import sys
sys.setrecursionlimit(10000000)
mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline

def readInts():
	return list(map(int, readline().split()))

def readTuples():
	return tuple(map(int, readline().split()))

def I():
	return int(readline())
n = I()
g = 0
lcm = 1
for i in range(n):
	A = I()
	g = math.gcd(A, g)
	if i == 0:
		lcm = A
	else:
		lcm = lcm * A // g
	g = lcm
print(lcm)


import math
N = int(input())
ans = 0
for i in range(N):
	if i == 0:
		ans = int(input())
	else:
		a = int(input())
		ans = a * ans // math.gcd(ans, a)
print(ans)


import fractions
s = 1
for _ in [0] * int(input()):
	x = int(input())
	s = s * x // fractions.gcd(s, x)
print(s)


import fractions
n = int(input())
ans = 1
t = [0] * n
for i in range(n):
	t[i] = int(input())
for i in t:
	ans = ans * i // fractions.gcd(ans, i)
print(ans)


from functools import *
from fractions import *
(n, *t) = map(int, open(0).read().split())

def ggcd(a, b):
	return a * b // gcd(a, b)
print(reduce(ggcd, t))


import math
N = int(input())
T = int(input())
for i in range(N - 1):
	t = int(input())
	T = T // math.gcd(T, t) * t
print(T)


from math import gcd
n = int(input())
T = []
for i in range(n):
	T.append(int(input()))
tmp = T[0]
for i in range(1, n):
	g = gcd(tmp, T[i])
	tmp = T[i] * tmp // g
print(tmp)


import math

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
n = int(input())
t = int(input())
for i in range(n - 1):
	t = lcm(t, int(input()))
print(t)


import fractions
N = int(input())
G = 1
for i in range(N):
	D = int(input())
	G = G * D // fractions.gcd(G, D)
print(G)


from fractions import gcd

def lcm(a, b):
	return a // gcd(a, b) * b
(N, x) = (int(input()), 1)
for _ in range(N):
	x = lcm(x, int(input()))
print(x)


import math
N = int(input())
ans = 1
for i in range(N):
	a = int(input())
	ans = ans * a // math.gcd(ans, a)
print(ans)


import math
n = int(input())
t = [int(input()) for i in range(n)]
res = t[0]
for i in range(1, n):
	res = res * t[i] // math.gcd(res, t[i])
print(res)


import fractions
N = int(input())
out = 1
for i in range(N):
	i = int(input())
	a = fractions.gcd(out, i)
	out = out * i // a
print(out)


from fractions import gcd
(n, *t) = map(int, open(0).read().split())
x = t.pop(0)
for i in range(len(t)):
	x = x * t[i] // gcd(x, t[i])
print(x)


from fractions import gcd
n = int(input())
T = [int(input()) for i in range(n)]
(G, L) = (T[0], T[0])
for t in T:
	G = gcd(L, t)
	L = L * t // G
print(L)


def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)
a = 1
for i in range(int(input())):
	h = int(input())
	a = a * h // gcd(a, h)
print(a)


def delete_head_zeros(n):
	n = str(n)
	l = len(n)
	if '.' in n:
		l = n.find('.')
	head_zeros = 0
	for i in range(l - 1):
		if n[i] == '0':
			head_zeros += 1
		else:
			break
	return n[head_zeros:]

def bigint_compare(a, b):
	a = delete_head_zeros(a)
	b = delete_head_zeros(b)
	if len(a) > len(b):
		return 1
	elif len(a) < len(b):
		return -1
	elif a > b:
		return 1
	elif a < b:
		return -1
	else:
		return 0

def bigint_plus(a, b):
	a = str(a)
	b = str(b)
	d = max([len(a), len(b)])
	a = '0' * (d - len(a)) + a
	b = '0' * (d - len(b)) + b
	ans = ''
	carry = 0
	for i in range(d):
		s = int(a[-i - 1]) + int(b[-i - 1]) + carry
		carry = s // 10
		ans = str(s % 10) + ans
	else:
		if carry:
			ans = str(carry) + ans
	return ans

def bigint_minus(a, b):
	a = str(a)
	b = str(b)
	M = []
	m = []
	sign = ''
	if len(a) > len(b) or (len(a) == len(b) and a >= b):
		[M, m] = [a, b]
	else:
		[M, m] = [b, a]
		sign = '-'
	m = '0' * (len(M) - len(m)) + m
	ans = ''
	borrow = 0
	for i in range(len(M)):
		s = int(M[-i - 1]) - int(m[-i - 1]) - borrow
		if s < 0:
			borrow = 1
			s += 10
		else:
			borrow = 0
		ans = str(s) + ans
	return sign + delete_head_zeros(ans)

def bigint_multiply(a, b):
	a = str(a)
	b = str(b)
	md = []
	for j in range(len(b)):
		carry = 0
		mj = ''
		for i in range(len(a)):
			m = int(a[-i - 1]) * int(b[-j - 1]) + carry
			carry = m // 10
			mj = str(m % 10) + mj
		else:
			if carry:
				mj = str(carry) + mj
		md.append(mj)
	ans = 0
	for k in range(len(md)):
		ans = bigint_plus(md[k] + '0' * k, ans)
	return ans

def bigint_divide(a, b, d=0):
	a = str(a)
	b = str(b)
	d = int(d)
	if d < 0:
		d = 0
	ans = ''
	r = ''
	for i in range(len(a) + d):
		q = 0
		if i < len(a):
			r += a[i]
		elif i == len(a):
			ans += '.'
			r += '0'
		else:
			r += '0'
		if bigint_compare(r, b) == -1:
			ans += str(q)
		else:
			while bigint_compare(r, b) >= 0:
				r = bigint_minus(r, b)
				q += 1
			ans += str(q)
	return delete_head_zeros(ans)

def gcd(a, b):
	if bigint_compare(a, b) >= 0:
		M = a
		m = b
	else:
		M = b
		m = a
	if m == '0':
		return M
	else:
		q = bigint_divide(M, m)
		r = bigint_minus(M, bigint_multiply(m, q))
		return gcd(m, r)

def lcm(a, b):
	return bigint_divide(bigint_multiply(a, b), gcd(a, b))

def main():
	N = int(input())
	T = [input() for i in range(N)]
	ans = 1
	for i in range(len(T)):
		ans = lcm(T[i], ans)
	print(ans)
main()


import math
N = int(input())
t1 = 1
for i in range(N):
	t2 = int(input())
	t1 = t1 * t2 // math.gcd(t1, t2)
print(t1)


from math import gcd
answer = 1
for _ in range(int(input())):
	T = int(input())
	answer = answer * T // gcd(answer, T)
print(answer)


import math
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
if n == 1:
	print(a[0])
else:
	lcm = a[0] * a[1] // math.gcd(a[0], a[1])
	for i in range(2, n):
		lcm = lcm * a[i] // math.gcd(lcm, a[i])
	print(lcm)


N = int(input())
T = []
for i in range(N):
	T.append(int(input()))
import math

def lcm(m, n):
	return m * n // math.gcd(m, n)

def lcm_list(nums):
	lcm_num = nums[0]
	for i in range(1, len(nums)):
		lcm_num = lcm(lcm_num, nums[i])
	return lcm_num
print(lcm_list(T))


import math
from functools import reduce

def lcm_base(x, y):
	return x * y // math.gcd(x, y)

def lcm_list(list):
	return reduce(lcm_base, list, 1)
N = int(input())
T = [int(input()) for i in range(N)]
print(lcm_list(T))


from fractions import gcd
n = int(input())
res = 1
for _ in range(n):
	x = int(input())
	res = res // gcd(res, x) * x
print(res)


import fractions
(N, T1) = (int(input()), int(input()))
for n in range(1, N):
	T2 = int(input())
	T1 = T1 * T2 // fractions.gcd(T1, T2)
print(T1)


from fractions import gcd
n = int(input())
T = [int(input()) for i in range(n)]
ans = 1
for t in T:
	ans = ans * t // gcd(ans, t)
print(ans)


import math
N = int(input())
T = [0] * N
for i in range(N):
	T[i] = int(input())
if N == 1:
	print(T[0])
elif N == 2:
	print(T[0] * T[1] // math.gcd(T[0], T[1]))
else:
	L = T[0]
	for i in range(1, N):
		L = L * T[i] // math.gcd(L, T[i])
	print(L)


def lcm(a):
	import math
	x = a[0]
	for i in range(1, len(a)):
		x = x * a[i] // math.gcd(x, a[i])
	return x

def resolve():
	N = int(input())
	T = [int(input()) for _ in range(N)]
	print(lcm(T))
resolve()


from math import gcd
n = int(input())
t = list([int(input()) for _ in range(n)])
x = 1
for i in t:
	x = x * i // gcd(x, i)
print(x)