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 long long const1 = 1e9 + 7;
long long power(long long a, long long b) {
  if (b == 0) {
    return 1;
  } else if (b % 2 == 0) {
    long long t = power(a, b / 2);
    return t * t % const1;
  } else {
    long long t = power(a, b / 2);
    t = t * t % const1;
    return t * a % const1;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> erat(2e6 + 1, -1);
  for (long long i = 2; i <= 2e6; i++) {
    if (erat[i] == -1) {
      long long j = i;
      while (j <= 2e6) {
        erat[j] = i;
        j += i;
      }
    }
  }
  vector<long long> p(n);
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
  }
  sort(p.begin(), p.end());
  reverse(p.begin(), p.end());
  bool flag = true;
  set<pair<long long, pair<long long, long long> > > st;
  long long c = 1, pp = 0;
  vector<long long> type(n);
  for (long long i = 0; i < n; i++) {
    set<pair<long long, pair<long long, long long> > >::iterator it;
    it = st.lower_bound({p[i], {0, 0}});
    if (it != st.end() && it->first == p[i]) {
      type[i] = 2;
      long long a = p[i] - 1;
      while (a > 1) {
        long long cnt1 = 0;
        long long q = erat[a];
        while (a % q == 0) {
          cnt1++;
          a = a / q;
        }
        it = st.lower_bound({q, {0, 0}});
        if (it == st.end() || it->first != q) {
          st.insert({q, {cnt1, 1}});
        } else if (it->second.first < cnt1) {
          st.erase(*it);
          st.insert({q, {cnt1, 1}});
        } else if (it->second.first == cnt1) {
          long long cnt2 = 1 + it->second.second;
          st.erase(*it);
          st.insert({q, {cnt1, cnt2}});
        }
      }
    } else {
      type[i] = 1;
      st.insert({p[i], {1, 1}});
    }
  }
  set<pair<long long, pair<long long, long long> > >::iterator it;
  for (long long i = 0; i < n; i++) {
    if (type[i] == 1) {
      it = st.lower_bound({p[i], {0, 0}});
      if (it->second.first > 1 || it->second.second > 1) {
        pp = 1;
      }
    } else {
      long long a = p[i] - 1;
      if (p[i] - 1 == 1) {
        pp = 1;
      }
      bool flag = true;
      while (a > 1) {
        long long q = erat[a];
        long long cnt1 = 0;
        while (a % q == 0) {
          cnt1++;
          a = a / q;
        }
        it = st.lower_bound({q, {0, 0}});
        if (it->second.first == cnt1 && it->second.second == 1) {
          flag = false;
        }
      }
      if (flag) {
        pp = 1;
      }
    }
  }
  for (it = st.begin(); it != st.end(); it++) {
    c = c * power(it->first, it->second.first) % const1;
  }
  cout << (c + pp) % const1;
  return 0;
}