Problem: You are given a tuple generator f^{(k)} = (f_1^{(k)}, f_2^{(k)}, ..., f_n^{(k)}), where f_i^{(k)} = (a_i ⋅ f_i^{(k - 1)} + b_i) mod p_i and f^{(0)} = (x_1, x_2, ..., x_n). Here x mod y denotes the remainder of x when divided by y. All p_i are primes.

One can see that with fixed sequences x_i, y_i, a_i the tuples f^{(k)} starting from some index will repeat tuples with smaller indices. Calculate the maximum number of different tuples (from all f^{(k)} for k ≥ 0) that can be produced by this generator, if x_i, a_i, b_i are integers in the range [0, p_i - 1] and can be chosen arbitrary. The answer can be large, so print the remainder it gives when divided by 10^9 + 7

Input

The first line contains one integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the number of elements in the tuple.

The second line contains n space separated prime numbers — the modules p_1, p_2, …, p_n (2 ≤ p_i ≤ 2 ⋅ 10^6).

Output

Print one integer — the maximum number of different tuples modulo 10^9 + 7.

Examples

Input

4
2 3 5 7


Output

210


Input

3
5 3 3


Output

30

Note

In the first example we can choose next parameters: a = [1, 1, 1, 1], b = [1, 1, 1, 1], x = [0, 0, 0, 0], then f_i^{(k)} = k mod p_i.

In the second example we can choose next parameters: a = [1, 1, 2], b = [1, 1, 0], x = [0, 0, 1].

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline void proc_status() {
  ifstream t("/proc/self/status");
  cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
       << endl;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline T read() {
  register T sum(0), fg(1);
  register char ch(getchar());
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fg = -1;
  for (; isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
  return sum * fg;
}
const int MOD = (int)1e9 + 7;
inline int fpm(int x, int y) {
  int res = 1;
  for (; y; y >>= 1, x = (long long)x * x % MOD)
    if (y & 1) res = (long long)res * x % MOD;
  return res;
}
const int MAXN = (int)2e5, M = (int)2e6;
namespace MATH {
int p[M + 5], prime[M + 5], prime_cnt = 0;
inline void linear_sieve() {
  p[1] = 0;
  for (int i = 2; i <= M; ++i) {
    if (!p[i]) p[i] = i, prime[++prime_cnt] = i;
    for (int j = 1; j <= M && i * prime[j] <= M; ++j) {
      p[i * prime[j]] = prime[j];
      if (i % prime[j] == 0) break;
    }
  }
}
}  // namespace MATH
using MATH::p;
using MATH::prime;
using MATH::prime_cnt;
int n;
int a[MAXN + 5];
inline void input() {
  n = read<int>();
  for (int i = 1; i <= n; ++i) a[i] = read<int>();
}
inline void solve() {
  static int bkt[M + 5], id[M + 5], cnt[M + 5];
  sort(a + 1, a + n + 1, greater<int>());
  for (int i = 1; i <= n; ++i)
    if (bkt[a[i]] >= 1)
      for (int k = a[i] - 1; k > 1;) {
        int d = p[k], e = 0;
        while (k % d == 0) k /= d, ++e;
        if (chkmax(bkt[d], e))
          id[d] = i, cnt[d] = 1;
        else if (bkt[d] == e)
          ++cnt[d];
      }
    else
      bkt[a[i]] = 1, cnt[a[i]] = 1, id[a[i]] = i;
  static int vis[MAXN + 5];
  int pre = 0;
  for (int i = 1; i <= M; ++i)
    if (p[i] == i && cnt[i] == 1) vis[id[i]] = 1;
  for (int i = 1; i <= n; ++i)
    if (!vis[i]) {
      pre = 1;
      break;
    }
  int ans = 1;
  for (int i = 2; i <= M; ++i)
    if (p[i] == i) ans = (long long)ans * fpm(i, bkt[i]) % MOD;
  printf("%d\n", (pre + ans + MOD) % MOD);
}
int main() {
  MATH::linear_sieve();
  input();
  solve();
  return 0;
}