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 T1, typename T2>
string print_iterable(T1 begin_iter, T2 end_iter, int counter) {
  bool done_something = false;
  stringstream res;
  res << "[";
  for (; begin_iter != end_iter and counter; ++begin_iter) {
    done_something = true;
    counter--;
    res << *begin_iter << ", ";
  }
  string str = res.str();
  if (done_something) {
    str.pop_back();
    str.pop_back();
  }
  str += "]";
  return str;
}
vector<int> SortIndex(int size, std::function<bool(int, int)> compare) {
  vector<int> ord(size);
  for (int i = 0; i < size; i++) ord[i] = i;
  sort(ord.begin(), ord.end(), compare);
  return ord;
}
template <typename T>
bool MinPlace(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool MaxPlace(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename Container>
int SZ(const Container& S) {
  return S.size();
}
template <typename S, typename T>
ostream& operator<<(ostream& out, const pair<S, T>& p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  for (int i = 0; i < (int)v.size(); i++) {
    out << v[i];
    if (i != (int)v.size() - 1) out << ", ";
  }
  out << "]";
  return out;
}
const int MAXN = 2e6 + 100;
const long long mod = 1e9 + 7;
int esp[MAXN];
int ppp[MAXN];
int from[MAXN];
bool single_use[MAXN];
int cnt[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  for (int p = 2; p < MAXN; p++) {
    if (ppp[p]) continue;
    ppp[p] = p;
    for (int i = 2 * p; i < MAXN; i += p) ppp[i] = p;
  }
  int N;
  cin >> N;
  vector<int> primes(N);
  for (int i = 0; i < N; i++) cin >> primes[i];
  sort(primes.begin(), primes.end());
  reverse(primes.begin(), primes.end());
  for (int i = 0; i < N; i++) {
    int p = primes[i];
    if (esp[p]) {
      int x = p - 1;
      while (x != 1) {
        int e = 0;
        int q = ppp[x];
        while (x % q == 0) e++, x /= q;
        if (esp[q] < e) {
          esp[q] = e;
          cnt[q] = 1;
        } else if (esp[q] == e)
          cnt[q]++;
      }
    } else {
      single_use[i] = true;
      esp[p]++;
      cnt[p] = 1;
    }
  }
  int add1 = 0;
  for (int i = 0; i < N; i++) {
    int p = primes[i];
    if (single_use[i]) continue;
    int x = p - 1;
    bool useful = false;
    while (x != 1) {
      int e = 0;
      int q = ppp[x];
      while (x % q == 0) e++, x /= q;
      if (esp[q] == e and cnt[q] == 1) useful = true;
    }
    if (!useful) add1 = 1;
  }
  long long res = 1;
  for (int p = 2; p < MAXN; p++) {
    for (int e = 0; e < esp[p]; e++) res = (res * p) % mod;
  }
  cout << (res + add1) % mod << "\n";
}