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;
template <typename T>
ostream& operator<<(ostream& os, vector<T> a) {
  os << "( ";
  for (T& x : a) os << x << " ";
  os << ")\n";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> a) {
  os << "( ";
  for (T x : a) os << x << " ";
  os << ")\n";
  return os;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> a) {
  os << "(" << a.first << " " << a.second << ") ";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, complex<T> a) {
  os << "(r=" << a.real() << " i=" << a.imag() << ") ";
  return os;
}
const int base = 1000000007;
long long power(long long a, long long n, long long mod = base) {
  long long r = 1;
  while (n) {
    if (n & 1) r = r * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return r;
}
const int nmax = 2000011;
int f[nmax], maxi[nmax], cnt[nmax];
int main(int argc, char** argv) {
  for (int i = 2; i < nmax; ++i)
    if (f[i] == 0) {
      for (int j = i; j < nmax; j += i) f[j] = i;
    }
  int n;
  scanf("%d", &n);
  vector<int> p(n);
  for (auto& i : p) scanf("%d", &i);
  sort(p.begin(), p.end());
  reverse(p.begin(), p.end());
  auto split = [&](int first) {
    while (first > 1) {
      int u = f[first], k = 0;
      while (first % u == 0) {
        ++k;
        first /= u;
      }
      if (k > maxi[u]) {
        maxi[u] = k;
        cnt[u] = 1;
      } else if (k == maxi[u])
        ++cnt[u];
    }
  };
  vector<int> lst;
  for (auto first : p) {
    if (maxi[first]) {
      split(first - 1);
      lst.push_back(-first + 1);
    } else {
      split(first);
      lst.push_back(first);
    }
  }
  auto check = [&](int first) {
    while (first > 1) {
      int u = f[first], k = 0;
      while (first % u == 0) {
        ++k;
        first /= u;
      }
      if (k == maxi[u] && cnt[u] == 1) return 0;
    }
    return 1;
  };
  for (auto first : lst) {
    if (check(abs(first))) split(abs(first - 1));
  }
  int flag = 0;
  for (auto first : p) {
    if (check(first) && check(first - 1)) flag = 1;
  }
  long long ans = 1;
  for (int i = 2; i < nmax; ++i) {
    while (maxi[i]--) {
      ans = ans * i % base;
    }
  }
  ans += flag;
  cout << ans;
}