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;
void getre() {
  int x = 0;
  printf("%d\n", 1 / x);
}
void gettle() {
  int res = 1;
  while (1) res <<= 1;
  printf("%d\n", res);
}
template <typename T, typename S>
inline bool upmin(T &a, const S &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool upmax(T &a, const S &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename N, typename PN>
inline N flo(N a, PN b) {
  return a >= 0 ? a / b : -((-a - 1) / b) - 1;
}
template <typename N, typename PN>
inline N cei(N a, PN b) {
  return a > 0 ? (a - 1) / b + 1 : -(-a / b);
}
template <typename N>
N gcd(N a, N b) {
  return b ? gcd(b, a % b) : a;
}
template <typename N>
inline int sgn(N a) {
  return a > 0 ? 1 : (a < 0 ? -1 : 0);
}
inline void gn(long long &x) {
  int sg = 1;
  char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  c == '-' ? (sg = -1, x = 0) : (x = c - '0');
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= sg;
}
inline void gn(int &x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(unsigned long long &x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(double &x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline void gn(long double &x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline void gs(char *s) { scanf("%s", s); }
inline void gc(char &c) {
  while ((c = getchar()) > 126 || c < 33)
    ;
}
inline void pc(char c) { putchar(c); }
inline long long sqr(long long a) { return a * a; }
inline double sqrf(double a) { return a * a; }
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846264338327950288L;
const double eps = 1e-6;
const int mo = 1e9 + 7;
const int SIEVE_MAXN = 2000000 + 5;
int prime[SIEVE_MAXN > 100000 ? SIEVE_MAXN / 10 : 10000];
bool bo[SIEVE_MAXN];
int nex[21111111];
int sieve(int n) {
  int tot = 0;
  for (int i = 2; i <= n; i++) {
    if (!bo[i]) {
      prime[++tot] = i;
      nex[i] = i;
    }
    for (int j = 1; j <= tot && prime[j] * i <= n; j++) {
      bo[i * prime[j]] = 1;
      nex[i * prime[j]] = prime[j];
      if (i % prime[j] == 0) break;
    }
  }
  return tot;
}
int n;
int a[2222222];
int has[2222222];
int res[2222222];
int tot = 0;
int upd(int p) {
  res[++tot] = p;
  int ret = 0;
  while (p > 1) {
    int q = nex[p];
    int r = 0;
    while (p % q == 0) {
      p /= q;
      r++;
    }
    if (upmax(has[q], r)) ret = 1;
  }
  return ret;
}
int tim[2222222];
void upd2(int p) {
  while (p > 1) {
    int q = nex[p];
    int r = 0;
    while (p % q == 0) {
      p /= q;
      r++;
    }
    if (has[q] == r) {
      tim[q]++;
    }
  }
}
int upd3(int p) {
  while (p > 1) {
    int q = nex[p];
    int r = 0;
    while (p % q == 0) {
      p /= q;
      r++;
    }
    if (has[q] == r) {
      if (tim[q] == 1) return 0;
    }
  }
  return 1;
}
int main() {
  sieve(2000000);
  gn(n);
  for (int i = (1), _ed = (n + 1); i < _ed; i++) {
    int x;
    gn(x);
    a[x]++;
  }
  int noneed = 0;
  for (int p = 2000000; p >= 1; p--) {
    if (a[p]) {
      if (a[p] >= 2) {
        if (!upd(p)) noneed = 1;
        if (!upd(p - 1)) noneed = 1;
        if (a[p] >= 3) noneed = 1;
      } else {
        if (!has[p]) {
          if (!upd(p)) noneed = 1;
        } else {
          if (!upd(p - 1)) noneed = 1;
        }
      }
    }
  }
  int ret = 1;
  if (!noneed) {
    for (int i = (1), _ed = (tot + 1); i < _ed; i++) upd2(res[i]);
    for (int i = (1), _ed = (tot + 1); i < _ed; i++)
      if (upd3(res[i])) {
        noneed = 1;
        break;
      }
  }
  for (int i = (1), _ed = (2000000 + 1); i < _ed; i++)
    while (has[i] > 0) {
      (((ret) = 1ll * (ret) * (i) % mo) < 0 ? (ret) += mo : (ret));
      has[i]--;
    }
  if (noneed) (((ret) = ((ret) + (1)) % mo) < 0 ? (ret) += mo : (ret));
  printf("%d\n", ret);
  return 0;
}