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;
template <typename T>
bool get_int(T &x) {
  char t = getchar();
  bool neg = false;
  x = 0;
  for (; (t > '9' || t < '0') && t != '-' && t != EOF; t = getchar())
    ;
  if (t == '-') neg = true, t = getchar();
  if (t == EOF) return false;
  for (; t <= '9' && t >= '0'; t = getchar()) x = x * 10 + t - '0';
  if (neg) x = -x;
  return true;
}
template <typename T>
void print_int(T x) {
  if (x < 0) putchar('-'), x = -x;
  short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
const int inf = 0x3f3f3f3f;
const long long Linf = 1ll << 61;
const double pi = acos(-1.0);
const int mod = 1e9 + 7;
const int maxn = 2000111;
int mn[maxn], cnt[maxn], nxt[maxn];
void prework() {
  for (int i = 2; i < maxn; i++)
    if (mn[i] == 0)
      for (int j = i; j < maxn; j += i)
        if (!mn[j]) mn[j] = i;
  for (int i = 2; i < maxn; i++) {
    if (mn[i] != mn[i / mn[i]]) {
      cnt[i] = 1;
      nxt[i] = i / mn[i];
    } else {
      cnt[i] = cnt[i / mn[i]] + 1;
      nxt[i] = nxt[i / mn[i]];
    }
  }
}
int n, a[200111], b[200111], mx[maxn], mxc[maxn];
int main() {
  prework();
  get_int(n);
  for (int i = 1; i <= n; i++) get_int(a[i]);
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    if (!mx[a[i]]) {
      mx[a[i]] = 1;
      mxc[a[i]] = 1;
      b[i] = a[i];
    } else {
      int t = a[i] - 1;
      while (t != 1) {
        if (mx[mn[t]] < cnt[t]) {
          mx[mn[t]] = cnt[t];
          mxc[mn[t]] = 1;
        } else if (mx[mn[t]] == cnt[t])
          mxc[mn[t]]++;
        t = nxt[t];
      }
      b[i] = a[i] - 1;
    }
  }
  bool add = 0;
  for (int i = 1; i <= n; i++) {
    int t = b[i];
    bool ok = 0;
    while (t != 1) {
      if (mx[mn[t]] == cnt[t] && mxc[mn[t]] == 1) ok = 1;
      t = nxt[t];
    }
    if (!ok) add = 1;
  }
  int ans = 1;
  for (int i = 1; i < maxn; i++) {
    for (int j = 1; j <= mx[i]; j++) ans = (long long)ans * i % mod;
  }
  if (add) ans = (ans + 1) % mod;
  print_int(ans), puts("");
  return 0;
}