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 MAXSIZE = 10000020;
int bufpos;
char buf[MAXSIZE];
void init() {
  buf[fread(buf, 1, MAXSIZE, stdin)] = '\0';
  bufpos = 0;
}
int readint() {
  int val = 0;
  for (; !isdigit(buf[bufpos]); bufpos++)
    ;
  for (; isdigit(buf[bufpos]); bufpos++) val = val * 10 + buf[bufpos] - '0';
  return val;
}
char readchar() {
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  return buf[bufpos++];
}
int readstr(char* s) {
  int cur = 0;
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  for (; !isspace(buf[bufpos]); bufpos++) s[cur++] = buf[bufpos];
  s[cur] = '\0';
  return cur;
}
const int maxm = 2000002;
const int maxn = 200002;
const int mod = 1000000007;
int c[maxm];
bool ntprime[maxm];
int primes[maxm], cur;
void sieve(int n) {
  ntprime[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!ntprime[i]) {
      primes[++cur] = i;
      c[i] = i;
    }
    for (int j = 1; j <= cur; j++) {
      int t = i * primes[j];
      if (t > n) break;
      ntprime[t] = 1;
      c[t] = primes[j];
      if (i % primes[j] == 0) break;
    }
  }
}
int a[maxn];
int e[maxm], tat[maxm];
bool f[maxn];
int main() {
  init();
  int n = readint();
  sieve(2000000);
  for (int i = 1; i <= n; i++) a[i] = readint();
  sort(a + 1, a + n + 1);
  bool qwq = false;
  for (int i = n; i; i--)
    if (!e[a[i]])
      e[a[i]] = 1;
    else {
      f[i] = 1;
      int t = a[i] - 1;
      while (t != 1) {
        int s = 0, w = c[t];
        while (c[t] == w) t /= w, s++;
        if (e[w] < s)
          e[w] = s, tat[w] = 1;
        else if (e[w] == s)
          tat[w]++;
      }
    }
  for (int i = 1; i <= n; i++) {
    if (!f[i]) {
      if (e[a[i]] > 1 || tat[a[i]] > 1) qwq = true;
      continue;
    }
    int t = a[i] - 1;
    bool flag = false;
    while (t != 1) {
      int s = 0, w = c[t];
      while (c[t] == w) t /= w, s++;
      if (e[w] == s && tat[w] == 1) flag = true;
    }
    if (!flag) qwq = true;
  }
  long long ans = 1;
  for (int i = 1; i <= 2000000; i++)
    while (e[i]--) {
      ans = ans * i % mod;
    }
  if (qwq) ans = (ans + 1) % mod;
  printf("%lld", ans);
}