Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/sonlar-kop-sonlar-ekuki

LCM of many numbers

Medium 1000 ms 128 MB 47%
Share

You are given $n$ positive integers. Find their least common multiple (LCM). The answer can be very large; print it modulo $10^{9} + 7$.

Every number is factored into primes; for every prime the largest power is chosen

Input

The first line contains a positive integer $n$. The second line contains $n$ positive integers $a_{i}$ separated by spaces.

Output

One integer — the LCM modulo $10^{9} + 7$.

Note

$1 \le n \le 10^{5}$
$1 \le a_{i} \le 10^{6}$

Examples

Input #1
4
4 6 10 15
Output #1
60
Input #2
1
1
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.