#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long num = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    num = (num << 3) + (num << 1) + c - '0';
    c = getchar();
  }
  return num * neg;
}
const long long mod = 1e9 + 7;
long long n, a[200010], prime[2000010], cnt[2000010], pre, ans = 1,
                                                           used[2000010];
bool unpri[2000010], tag[2000010];
inline bool cmp1(int x, int y) { return x > y; }
inline void Eular(int N) {
  for (int i = 2; i <= N; i++) {
    if (!unpri[i]) prime[++prime[0]] = i;
    for (int j = 1; j <= prime[0] && i * prime[j] <= N; j++) {
      unpri[i * prime[j]] = 1;
      if (i % prime[j] == 0) break;
    }
  }
  return;
}
inline bool work(long long x) {
  int tmp, fail = 1;
  for (int i = 1; i <= prime[0]; i++) {
    if (prime[i] * prime[i] > x) break;
    tmp = 0;
    while (x % prime[i] == 0) tmp++, x /= prime[i];
    if (tmp > cnt[prime[i]])
      fail = 0, cnt[prime[i]] = tmp, used[prime[i]] = 1;
    else if (tmp == cnt[prime[i]])
      used[prime[i]]++;
  }
  if (!cnt[x])
    fail = 0, cnt[x] = 1, used[x] = 1;
  else if (cnt[x] == 1)
    used[x]++;
  return fail;
}
inline bool check(long long x) {
  int tmp, fail = 1;
  for (int i = 1; i <= prime[0]; i++) {
    if (prime[i] * prime[i] > x) break;
    tmp = 0;
    while (x % prime[i] == 0) tmp++, x /= prime[i];
    if (tmp == cnt[prime[i]] && used[prime[i]] == 1) fail = 0;
  }
  if (cnt[x] == 1 && used[x] == 1) fail = 0;
  return fail;
}
inline long long qpow(long long x, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = res * x % mod;
    x = x * x % mod;
    k >>= 1;
  }
  return res;
}
int main() {
  n = read();
  Eular(2000000);
  cnt[1] = 1;
  for (int i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1, cmp1);
  for (int i = 1; i <= n; i++) {
    if (!cnt[a[i]])
      cnt[a[i]]++;
    else {
      tag[i] = 1;
      if (work(a[i] - 1)) pre = 1;
    }
  }
  for (int i = 1; i <= n; i++)
    if (tag[i])
      if (check(a[i] - 1)) pre = 1;
  for (int i = 2; i <= 2000000; i++) ans = ans * qpow(i, cnt[i]) % mod;
  cout << (ans + pre) % mod << endl;
  return 0;
}

### Prompt

Develop a solution in CPP to the problem described below:

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].

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long num = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    num = (num << 3) + (num << 1) + c - '0';
    c = getchar();
  }
  return num * neg;
}
const long long mod = 1e9 + 7;
long long n, a[200010], prime[2000010], cnt[2000010], pre, ans = 1,
                                                           used[2000010];
bool unpri[2000010], tag[2000010];
inline bool cmp1(int x, int y) { return x > y; }
inline void Eular(int N) {
  for (int i = 2; i <= N; i++) {
    if (!unpri[i]) prime[++prime[0]] = i;
    for (int j = 1; j <= prime[0] && i * prime[j] <= N; j++) {
      unpri[i * prime[j]] = 1;
      if (i % prime[j] == 0) break;
    }
  }
  return;
}
inline bool work(long long x) {
  int tmp, fail = 1;
  for (int i = 1; i <= prime[0]; i++) {
    if (prime[i] * prime[i] > x) break;
    tmp = 0;
    while (x % prime[i] == 0) tmp++, x /= prime[i];
    if (tmp > cnt[prime[i]])
      fail = 0, cnt[prime[i]] = tmp, used[prime[i]] = 1;
    else if (tmp == cnt[prime[i]])
      used[prime[i]]++;
  }
  if (!cnt[x])
    fail = 0, cnt[x] = 1, used[x] = 1;
  else if (cnt[x] == 1)
    used[x]++;
  return fail;
}
inline bool check(long long x) {
  int tmp, fail = 1;
  for (int i = 1; i <= prime[0]; i++) {
    if (prime[i] * prime[i] > x) break;
    tmp = 0;
    while (x % prime[i] == 0) tmp++, x /= prime[i];
    if (tmp == cnt[prime[i]] && used[prime[i]] == 1) fail = 0;
  }
  if (cnt[x] == 1 && used[x] == 1) fail = 0;
  return fail;
}
inline long long qpow(long long x, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = res * x % mod;
    x = x * x % mod;
    k >>= 1;
  }
  return res;
}
int main() {
  n = read();
  Eular(2000000);
  cnt[1] = 1;
  for (int i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1, cmp1);
  for (int i = 1; i <= n; i++) {
    if (!cnt[a[i]])
      cnt[a[i]]++;
    else {
      tag[i] = 1;
      if (work(a[i] - 1)) pre = 1;
    }
  }
  for (int i = 1; i <= n; i++)
    if (tag[i])
      if (check(a[i] - 1)) pre = 1;
  for (int i = 2; i <= 2000000; i++) ans = ans * qpow(i, cnt[i]) % mod;
  cout << (ans + pre) % mod << endl;
  return 0;
}

```