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 Imx = 2147483647;
const long long Lbig = 2e18;
const int mod = 1e9 + 7;
struct fastio {
  char s[100000];
  int it, len;
  fastio() { it = len = 0; }
  inline char get() {
    if (it < len) return s[it++];
    it = 0;
    len = fread(s, 1, 100000, stdin);
    if (len == 0)
      return EOF;
    else
      return s[it++];
  }
  bool notend() {
    char c = get();
    while (c == ' ' || c == '\n') c = get();
    if (it > 0) it--;
    return c != EOF;
  }
} _buff;
inline long long getnum() {
  long long r = 0;
  bool ng = 0;
  char c;
  c = _buff.get();
  while (c != '-' && (c < '0' || c > '9')) c = _buff.get();
  if (c == '-') ng = 1, c = _buff.get();
  while (c >= '0' && c <= '9') r = r * 10 + c - '0', c = _buff.get();
  return ng ? -r : r;
}
template <class T>
inline void putnum(T x) {
  if (x < 0) putchar('-'), x = -x;
  register short a[20] = {}, sz = 0;
  while (x) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
inline char getreal() {
  char c = _buff.get();
  while (c <= 32) c = _buff.get();
  return c;
}
long long qpow(long long x, long long k) {
  return k == 0 ? 1
                : 1ll * qpow(1ll * x * x % mod, k >> 1) * (k & 1 ? x : 1) % mod;
}
int n;
bool tmp[2000111];
bool np[2000111];
int cnt[2000111], mcnt[2000111];
vector<pair<int, int> > pfac[2000111];
int main() {
  n = getnum();
  vector<int> v, v2;
  for (int i = 1; i <= n; i++) {
    int x;
    x = getnum();
    v.push_back(x);
    tmp[x - 1] = 1;
  }
  for (int i = 2; i <= 2000000; i++) {
    if (np[i]) continue;
    pfac[i].push_back(make_pair(i, 1));
    for (int j = i + i; j <= 2000000; j += i) {
      np[j] = 1;
      if (tmp[j]) {
        int c = 0, t = j;
        while (t % i == 0) {
          t /= i;
          c++;
        }
        pfac[j].push_back(make_pair(i, c));
      }
    }
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  bool add1 = 0;
  for (int i = 0; i < v.size(); i++) {
    int x = v[i];
    if (cnt[x] == 0) {
      cnt[x] = 1;
    } else {
      v2.push_back(x);
      bool ok = 0;
      for (int j = 0; j < pfac[x - 1].size(); j++) {
        int pr = pfac[x - 1][j].first, k = pfac[x - 1][j].second;
        if (cnt[pr] < k) {
          cnt[pr] = k;
          mcnt[pr] = 1;
          ok = 1;
        } else if (cnt[pr] == k) {
          mcnt[pr]++;
        }
      }
      if (!ok) add1 = 1;
    }
  }
  if (!add1) {
    for (int i = 0; i < v2.size(); i++) {
      int x = v2[i];
      bool unn = 1;
      for (int j = 0; j < pfac[x - 1].size(); j++) {
        int pr = pfac[x - 1][j].first, k = pfac[x - 1][j].second;
        unn &= cnt[pr] > k || (cnt[pr] == k && mcnt[pr] >= 2);
      }
      if (unn) add1 = 1;
    }
  }
  long long ans = 1;
  for (int i = 2; i <= 2000000; i++) {
    if (cnt[i]) ans = ans * qpow(i, cnt[i]) % mod;
  }
  cout << (ans + add1) % mod << endl;
  return 0;
}