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 int mod = 1e9 + 7;
map<int, int> primes;
map<int, int> prime_to_index;
vector<pair<int, int> > max_prime_powers;
vector<int> p;
set<int> necessary;
inline int A(long long a) { return a % mod; }
bool Is_new_look_at_primes(int a) {
  if (a == 1) return false;
  if (a % 2 == 1) {
    int b = prime_to_index[a];
    if (max_prime_powers[b].first == 0) {
      max_prime_powers[b].first = 1;
      return true;
    }
    return false;
  }
  bool answer = false;
  for (int i = 0; i < p.size(); i++) {
    int current = 0;
    while (a % p[i] == 0) {
      current++;
      a /= p[i];
    }
    if (current > max_prime_powers[i].first) answer = true;
    max_prime_powers[i].first = max(max_prime_powers[i].first, current);
    if (a == 1) break;
    if (a < (long long)p[i] * p[i]) {
      int b = prime_to_index[a];
      if (max_prime_powers[b].first == 0) {
        max_prime_powers[b].first = 1;
        answer = true;
      }
      break;
    }
  }
  return answer;
}
void Fill_second(int a) {
  if (a == 1) return;
  if (a % 2 == 1) {
    int b = prime_to_index[a];
    if (max_prime_powers[b].first == 1) max_prime_powers[b].second++;
    return;
  }
  for (int i = 0; i < p.size(); i++) {
    int current = 0;
    while (a % p[i] == 0) {
      current++;
      a /= p[i];
    }
    if (current == max_prime_powers[i].first) max_prime_powers[i].second++;
    if (a == 1) return;
    if (a < (long long)p[i] * p[i]) {
      int b = prime_to_index[a];
      if (max_prime_powers[b].first == 1) max_prime_powers[b].second++;
      return;
    }
  }
}
bool Can_not_be_used(int a) {
  if (a == 1) return true;
  if (a % 2 == 1) {
    int b = prime_to_index[a];
    return 2 < max_prime_powers[b].first + max_prime_powers[b].second;
  }
  for (int i = 0; i < p.size(); i++) {
    int current = 0;
    while (a % p[i] == 0) {
      current++;
      a /= p[i];
    }
    if (current >= max_prime_powers[i].first + max_prime_powers[i].second - 1)
      return false;
    if (a == 1) break;
    if (a < (long long)p[i] * p[i]) {
      int b = prime_to_index[a];
      if (2 >= max_prime_powers[b].first + max_prime_powers[b].second)
        return false;
      break;
    }
  }
  return true;
}
void Fill_p() {
  const int max_p = 2000000;
  vector<bool> is_prime(max_p, true);
  for (int i = 2; i < max_p; i++) {
    if (is_prime[i]) {
      p.push_back(i);
      prime_to_index[i] = p.size() - 1;
      max_prime_powers.push_back(make_pair(0, 0));
      for (long long j = (long long)i * i; j < max_p; j += i)
        is_prime[j] = false;
    }
  }
}
int Pow(int a, int n) {
  if (n == 0) return 1;
  if (n % 2 == 0) return Pow(A((long long)a * a), n / 2);
  return A((long long)Pow(A((long long)a * a), n / 2) * a);
}
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  Fill_p();
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (primes.find(a) == primes.end())
      primes[a] = 1;
    else
      primes[a]++;
  }
  bool is_plus1_used = false;
  vector<int> used_values;
  for (map<int, int>::reverse_iterator it = primes.rbegin(),
                                       it_end = primes.rend();
       it != it_end; ++it) {
    if (it->second == 1) {
      if (Is_new_look_at_primes(it->first))
        used_values.push_back(it->first);
      else {
        Is_new_look_at_primes(it->first - 1);
        used_values.push_back(it->first - 1);
      }
    } else {
      Is_new_look_at_primes(it->first);
      Is_new_look_at_primes(it->first - 1);
      used_values.push_back(it->first);
      used_values.push_back(it->first - 1);
      if (it->second >= 3) is_plus1_used = true;
    }
  }
  if (is_plus1_used) {
    long long answer = 1;
    for (int i = 0; i < p.size(); i++)
      answer = A(answer * Pow(p[i], max_prime_powers[i].first));
    answer = A(answer + 1);
    cout << answer << endl;
    return 0;
  }
  for (int i = 0; i < used_values.size(); i++) Fill_second(used_values[i]);
  for (int i = 0; i < used_values.size(); i++)
    if (Can_not_be_used(used_values[i])) {
      is_plus1_used = true;
      break;
    }
  long long answer = 1;
  for (int i = 0; i < p.size(); i++)
    answer = A(answer * Pow(p[i], max_prime_powers[i].first));
  if (is_plus1_used) answer = A(answer + 1);
  cout << answer << endl;
}