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;
namespace mine {
void chmax(int &x, const long long y) { x = (x > y ? x : y); }
void chmin(int &x, const long long y) { x = (x < y ? x : y); }
long long qread() {
  long long ans = 0, f = 1;
  char c = getchar();
  while (c < '0' or c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ('0' <= c and c <= '9') ans = ans * 10 + c - '0', c = getchar();
  return ans * f;
}
void write(long long num) {
  if (num < 0) putchar('-'), num = -num;
  if (num >= 10) write(num / 10);
  putchar('0' + num % 10);
}
void write1(long long num) {
  write(num);
  putchar(' ');
}
void write2(long long num) {
  write(num);
  putchar('\n');
}
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
  if (a <= -MOD) a += MOD;
}
long long qpower(long long x, int e) {
  long long ans = 1;
  while (e) {
    if (e & 1) ans = ans * x % MOD;
    x = x * x % MOD;
    e >>= 1;
  }
  return ans;
}
long long invm(long long x) { return qpower(x, MOD - 2); }
const int MAX_N = 2e6 + 10;
bool gg[MAX_N];
int pp = 0, prm[MAX_N], mip[MAX_N];
void pre() {
  for (int i = 2; i < MAX_N; i++) {
    if (!gg[i]) prm[++pp] = i, mip[i] = pp;
    for (int j = 1; j <= pp and (long long) prm[j] * i < MAX_N; j++) {
      int to = prm[j] * i;
      gg[to] = 1;
      mip[to] = j;
      if (i % prm[j] == 0) break;
    }
  }
}
int p[MAX_N];
pair<int, int> cnt[MAX_N];
void insert(int id, int num) {
  if (num >= cnt[id].first)
    cnt[id].second = cnt[id].first, cnt[id].first = num;
  else if (num > cnt[id].second)
    cnt[id].second = num;
}
bool fine(int now) {
  if (now <= 0) return 0;
  while (now > 1) {
    int t = 0, id = mip[now];
    while (now % prm[id] == 0) now /= prm[id], t++;
    if (cnt[id].first != cnt[id].second and cnt[id].first == t) return 0;
  }
  return 1;
}
void main() {
  pre();
  int n = qread();
  for (int i = 1; i <= n; i++) p[i] = qread();
  sort(p + 1, p + n + 1);
  for (int i = n; i >= 1; i--) {
    if (!cnt[mip[p[i]]].first) {
      cnt[mip[p[i]]].first = 1;
      p[i] = 0;
      continue;
    }
    int now = p[i] - 1;
    while (now > 1) {
      int t = 0, id = mip[now];
      while (now % prm[id] == 0) now /= prm[id], t++;
      insert(id, t);
    }
  }
  bool bk = 0;
  for (int i = 1; i <= n; i++)
    if (fine(p[i] - 1)) {
      bk = 1;
      break;
    }
  long long ans = 1;
  for (int i = 1; i <= pp; i++) {
    while (cnt[i].first--) ans = ans * prm[i] % MOD;
  }
  write((ans + bk) % MOD);
}
};  // namespace mine
int main() {
  srand(time(0));
  mine::main();
}