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;
int prime[2000010];
int flag[2000010];
int vst[2000010];
int cnt[2000010];
int p[2000010];
int r[2000010];
int s[2000010];
int num[2000010];
int np;
int pp[2000010];
void prepare() {
  for (int i = 2; i < 2000010; i++) {
    if (!flag[i]) {
      prime[np++] = i;
      flag[i] = i;
    }
    for (int j = 0; j < np && prime[j] * i < 2000010; j++) {
      flag[i * prime[j]] = prime[j];
      if (flag[i] == prime[j]) break;
    }
  }
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
bool cmp(int u, int v) { return u > v; }
int main() {
  prepare();
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
    cnt[p[i]]++;
  }
  sort(p + 1, p + n + 1, cmp);
  n = unique(p + 1, p + n + 1) - p - 1;
  int Flag = 0, m = 0;
  for (int i = 1; i <= n; i++) {
    if (!Flag) {
      if (cnt[p[i]] > 2 || (cnt[p[i]] == 2 && vst[p[i]] == 1)) Flag = 1;
      if (!Flag) {
        if (cnt[p[i]] == 1 && vst[p[i]] == 1) pp[m++] = p[i];
        if (cnt[p[i]] == 2 && vst[p[i]] == 0) pp[m++] = p[i];
      }
    }
    if (!vst[p[i]]) r[p[i]]++;
    if (cnt[p[i]] > 1 || vst[p[i]]) {
      int st = p[i] - 1;
      while (st > 1) {
        int q = flag[st];
        vst[q] = 1;
        int t = 0;
        while (st % q == 0) {
          t++;
          st /= q;
          if (r[q] < t) r[q] = t;
        }
      }
    }
  }
  if (!Flag) {
    for (int i = 0; i < m; i++) {
      int st = pp[i] - 1;
      while (st > 1) {
        int q = flag[st];
        int t = 0;
        while (st % q == 0) {
          t++;
          st /= q;
        }
        if (s[q] < t) {
          num[q] = 1;
          s[q] = t;
        } else if (s[q] == t)
          num[q]++;
      }
    }
    for (int i = 0; i < m; i++) {
      int Vst = 0;
      int st = pp[i] - 1;
      while (st > 1) {
        int q = flag[st];
        int t = 0;
        while (st % q == 0) {
          t++;
          st /= q;
        }
        if (t == s[q] && num[q] == 1) Vst = 1;
      }
      if (!Vst) {
        Flag = 1;
        break;
      }
    }
  }
  int ans = 1;
  for (int i = 2; i <= p[1]; i++)
    ans = (long long)ans * power(i, r[i], 1000000007) % 1000000007;
  ans += Flag;
  ans %= 1000000007;
  printf("%d\n", ans);
  return 0;
}