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;
const int MAXN = 2e5 + 5, MAXM = 2e6 + 5, Mod = 1e9 + 7;
char buf[1 << 12], *pp1 = buf, *pp2 = buf, nc;
int ny;
inline char gc() {
  return pp1 == pp2 &&
                 (pp2 = (pp1 = buf) + fread(buf, 1, 1 << 12, stdin), pp1 == pp2)
             ? EOF
             : *pp1++;
}
inline int read() {
  int x = 0;
  for (ny = 1; nc = gc(), (nc < 48 || nc > 57) && nc != EOF;)
    if (nc == 45) ny = -1;
  if (nc < 0) return nc;
  for (x = nc - 48; nc = gc(), 47 < nc && nc < 58 && nc != EOF;
       x = (x << 3) + (x << 1) + (nc ^ 48))
    ;
  return x * ny;
}
int p[MAXM], vis[MAXM], low[MAXM], cnt, g[MAXM], Max;
inline void Init(int n = 2e6) {
  for (int i = (2); i <= (n); i++) {
    if (!vis[i]) p[++cnt] = i, low[i] = i;
    for (int j = 1; j <= cnt && i * p[j] <= n; j++) {
      vis[i * p[j]] = 1, low[i * p[j]] = p[j];
      if (i % p[j] == 0) break;
    }
  }
}
inline int Fp(int x, int k) {
  int ans = 1;
  for (; k; k >>= 1, x = 1ll * x * x % Mod)
    if (k & 1) ans = 1ll * ans * x % Mod;
  return ans;
}
int n, a[MAXN], Cnt[MAXM], Cntt[MAXM];
int main() {
  Init(), Max = 2e6, n = read();
  for (int i = (1); i <= (n); i++) a[i] = read();
  sort(a + 1, a + n + 1);
  for (int i = (n); i >= (1); i--) {
    if (Cnt[a[i]]) {
      for (int t = a[i] - 1; t != 1;) {
        int h = low[t], cnt = 0;
        for (; low[t] == h; t /= h, cnt++)
          ;
        Cnt[h] = max(Cnt[h], cnt);
      }
    } else
      Cnt[a[i]] = 1;
  }
  for (int i = (n); i >= (1); i--) {
    if (Cntt[a[i]]) {
      for (int t = a[i] - 1; t != 1;) {
        int h = low[t], cnt = 0;
        for (; low[t] == h; t /= h, cnt++)
          ;
        if (cnt == Cnt[h]) g[h]++;
        Cntt[h] = max(Cntt[h], cnt);
      }
    } else
      Cntt[a[i]] = 1;
  }
  int flg = 0;
  memset(Cntt, 0, sizeof(Cntt));
  for (int i = (n); i >= (1); i--) {
    if (Cntt[a[i]]) {
      int tmp = 0;
      for (int t = a[i] - 1; t != 1;) {
        int h = low[t], cnt = 0;
        for (; low[t] == h; t /= h, cnt++)
          ;
        if (cnt == Cnt[h] && g[h] == 1) tmp = 1;
        Cntt[h] = max(Cntt[h], cnt);
      }
      if (!tmp) flg = 1;
    } else
      Cntt[a[i]] = 1;
  }
  int ans = 1;
  for (int i = (1); i <= (Max); i++)
    if (Cnt[i]) ans = 1ll * ans * Fp(i, Cnt[i]) % Mod;
  ans = (ans + flg) % Mod;
  cout << ans << "\n";
  return 0;
}