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;
int MOD = 1000 * 1000 * 1000 + 7;
using vec = vector<int>;
vec calc_lp(int n, vec& primes) {
  vec lp(n);
  primes.clear();
  for (int i = 2; i < n; ++i) {
    if (!lp[i]) {
      lp[i] = i;
      primes.push_back(i);
    }
    for (int j = 0;
         j < primes.size() && primes[j] <= lp[i] && i * primes[j] < n; ++j)
      lp[i * primes[j]] = primes[j];
  }
  return lp;
}
int mod_mul(int a, int b) { return (a * 1ll * b) % MOD; }
unordered_map<int, int> factorize(int x, const vec& lp) {
  unordered_map<int, int> factor;
  while (x > 1) {
    auto it = factor.insert({lp[x], 0});
    it.first->second += 1;
    x /= lp[x];
  }
  return factor;
}
int main() {
  int n;
  cin >> n;
  vector<int> pp(n);
  for (int i = 0; i < n; ++i) {
    cin >> pp[i];
  }
  sort(pp.begin(), pp.end(), greater<int>());
  vec primes;
  vec lp = calc_lp(pp.front(), primes);
  unordered_map<int, int> res_factor;
  unordered_map<int, int> max_power_cover;
  vec decreased_primes;
  for (int& p : pp) {
    auto was_p = res_factor.insert({p, 1});
    if (!was_p.second) {
      decreased_primes.push_back(p - 1);
      auto p_factor = factorize(p - 1, lp);
      for (auto& ff : p_factor) {
        auto it = res_factor.insert({ff.first, 0});
        if (it.second) max_power_cover.insert({ff.first, 1});
        if (ff.second == it.first->second) max_power_cover[ff.first] += 1;
        if (ff.second > it.first->second) {
          it.first->second = ff.second;
          max_power_cover[ff.first] = 1;
        }
      }
    }
  }
  int plus_one = 0;
  for (int& pm1 : decreased_primes) {
    auto p_factor = factorize(pm1, lp);
    bool needed = false;
    for (auto& ff : p_factor) {
      int fp = ff.first, fcount = ff.second;
      if ((res_factor[fp] == fcount) && (max_power_cover[fp] == 1))
        needed = true;
    }
    if (!needed) plus_one = 1;
  }
  int res = 1;
  for (auto& ff : res_factor)
    for (int pc = 0; pc < ff.second; ++pc) res = mod_mul(res, ff.first);
  res = (res + plus_one) % MOD;
  cout << res << endl;
  return 0;
}