#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  register char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + (ch ^ '0');
    ch = getchar();
  }
  return f ? x : -x;
}
const int N = 2e5 + 5, M = 2e6 + 5, mod = 1e9 + 7;
int n, p[N], num[M], cnt[M], a[N];
inline int power(int b, int n) {
  int ans = 1;
  for (; n; n >>= 1, b = 1ll * b * b % mod)
    if (n & 1) ans = 1ll * ans * b % mod;
  return ans;
}
int insert(int p) {
  if (!num[p]) return num[p] = cnt[p] = 1, 0;
  --p;
  for (int i = 2; i <= sqrt(p); ++i) {
    if (p % i) continue;
    int c = 0;
    while (p % i == 0) p /= i, ++c;
    if (num[i] < c)
      num[i] = c, cnt[i] = 1;
    else if (num[i] == c)
      ++cnt[i];
  }
  if (p ^ 1) {
    int c = 1;
    if (num[p] < c)
      num[p] = c, cnt[p] = 1;
    else if (num[p] == c)
      ++cnt[p];
  }
  return 1;
}
bool check(int x) {
  for (int i = 2; i <= sqrt(x); ++i) {
    if (x % i) continue;
    int c = 0;
    while (x % i == 0) x /= i, ++c;
    if (c == num[i] && cnt[i] == 1) return 0;
  }
  if (x ^ 1 && num[x] == 1 && cnt[x] == 1) return 0;
  return 1;
}
int main() {
  n = read();
  for (int i = (1), _ed = (n); i <= _ed; ++i) p[i] = read();
  sort(p + 1, p + n + 1, [&](int a, int b) { return a > b; });
  for (int i = (1), _ed = (n); i <= _ed; ++i) a[i] = p[i] - insert(p[i]);
  int ans = 1;
  for (int i = (2), _ed = (M - 1); i <= _ed; ++i)
    ans = 1ll * ans * power(i, num[i]) % mod;
  for (int i = (1), _ed = (n); i <= _ed; ++i)
    if (check(a[i])) {
      ans = (ans + 1) % mod;
      break;
    }
  printf("%d\n", ans);
  return 0;
}

### Prompt

Please create a solution in Cpp to the following 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].

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  register char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + (ch ^ '0');
    ch = getchar();
  }
  return f ? x : -x;
}
const int N = 2e5 + 5, M = 2e6 + 5, mod = 1e9 + 7;
int n, p[N], num[M], cnt[M], a[N];
inline int power(int b, int n) {
  int ans = 1;
  for (; n; n >>= 1, b = 1ll * b * b % mod)
    if (n & 1) ans = 1ll * ans * b % mod;
  return ans;
}
int insert(int p) {
  if (!num[p]) return num[p] = cnt[p] = 1, 0;
  --p;
  for (int i = 2; i <= sqrt(p); ++i) {
    if (p % i) continue;
    int c = 0;
    while (p % i == 0) p /= i, ++c;
    if (num[i] < c)
      num[i] = c, cnt[i] = 1;
    else if (num[i] == c)
      ++cnt[i];
  }
  if (p ^ 1) {
    int c = 1;
    if (num[p] < c)
      num[p] = c, cnt[p] = 1;
    else if (num[p] == c)
      ++cnt[p];
  }
  return 1;
}
bool check(int x) {
  for (int i = 2; i <= sqrt(x); ++i) {
    if (x % i) continue;
    int c = 0;
    while (x % i == 0) x /= i, ++c;
    if (c == num[i] && cnt[i] == 1) return 0;
  }
  if (x ^ 1 && num[x] == 1 && cnt[x] == 1) return 0;
  return 1;
}
int main() {
  n = read();
  for (int i = (1), _ed = (n); i <= _ed; ++i) p[i] = read();
  sort(p + 1, p + n + 1, [&](int a, int b) { return a > b; });
  for (int i = (1), _ed = (n); i <= _ed; ++i) a[i] = p[i] - insert(p[i]);
  int ans = 1;
  for (int i = (2), _ed = (M - 1); i <= _ed; ++i)
    ans = 1ll * ans * power(i, num[i]) % mod;
  for (int i = (1), _ed = (n); i <= _ed; ++i)
    if (check(a[i])) {
      ans = (ans + 1) % mod;
      break;
    }
  printf("%d\n", ans);
  return 0;
}

```