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 int read() {
  int sum = 0, p = 1;
  char ch = getchar();
  while (!(('0' <= ch && ch <= '9') || ch == '-')) ch = getchar();
  if (ch == '-') p = -1, ch = getchar();
  while ('0' <= ch && ch <= '9') sum = sum * 10 + ch - 48, ch = getchar();
  return sum * p;
}
const int maxp = 2e6 + 20;
const int maxn = maxp;
const int mod = 1e9 + 7;
int n, p[maxn], mark[maxn], prime[maxn], tot, d[maxn];
inline void prepare() {
  for (int i = (2), _end_ = (2e6); i <= _end_; i++) {
    if (!mark[i]) prime[++tot] = i, mark[i] = tot, d[i] = i;
    for (int j = 1; i * prime[j] <= 2e6; j++) {
      int k = i * prime[j];
      mark[k] = 1;
      d[k] = prime[j];
      if (!(i % prime[j])) break;
    }
  }
}
inline void init() {
  n = read();
  for (int i = (1), _end_ = (n); i <= _end_; i++) p[i] = read();
  sort(p + 1, p + n + 1);
}
int cnt[maxp], ok[maxp];
int tag[maxp];
inline int power(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (long long)ans * a % mod;
    b >>= 1;
    a = (long long)a * a % mod;
  }
  return ans;
}
inline void doing() {
  for (int i = (n), _end_ = (1); i >= _end_; i--) {
    int x = p[i];
    if (!cnt[x]) {
      cnt[x] = 1;
      tag[x] = 1;
      ok[i] = 0;
    } else {
      ok[i] = 1;
      int u = x - 1;
      while (u > 1) {
        int t = d[u], sum = 0;
        while (!(u % t)) u /= t, sum++;
        if (cnt[t] < sum)
          cnt[t] = sum, tag[t] = 1;
        else if (cnt[t] == sum)
          tag[t]++;
      }
    }
  }
  int ad = 0;
  for (int i = (n), _end_ = (1); i >= _end_; i--) {
    int u = p[i] - ok[i], flg = 1;
    while (u > 1) {
      int t = d[u], sum = 0;
      while (!(u % t)) u /= t, sum++;
      if (tag[t] == 1 && cnt[t] == sum) flg = 0;
    }
    ad |= flg;
  }
  int ans = 1;
  for (int i = (1), _end_ = (2e6); i <= _end_; i++)
    if (cnt[i]) ans = (long long)ans * power(i, cnt[i]) % mod;
  printf("%d\n", (ans + ad) % mod);
}
int main() {
  prepare();
  init();
  doing();
  return 0;
}