template<typename T> inlineboolgetmin(T& a, const T& b){ return a > b && (a = b, true); } template<typename T> inlineboolgetmax(T& a, const T& b){ return a < b && (a = b, true); }
int n, lim, a[nmax], f[kmax], g[kmax], mu[kmax], pr[pmax]; bool com[kmax], has[kmax]; inlineintpro(int x){ return x >= mod? x - mod: x; } inlineintper(int x){ return x < 0? x + mod: x; } inline qe ksm(qe x, int p = mod - 2){ qe ret = 1; for (; p; p >>= 1, (x *= x) %= mod) if (p & 1) (ret *= x) %= mod; return ret; } inlinevoidsieve(int n){ mu[1] = 1; for (int i = 2; i <= n; ++i) { if (!com[i]) { pr[++pr[0]] = i; mu[i] = -1; } for (int j = 1, k; j <= pr[0] && (k = i * pr[j]) <= n; ++j) { com[k] = 1; if (i % pr[j]) mu[k] = -mu[i]; elsebreak; } } } intmain(){ cin > n; for (int i = 1; i <= n; ++i) { constintx(R); has[x] = 1; getmax(lim, x); } f[1] = g[1] = 1; for (int i = 2; i <= lim; ++i) { f[i] = pro(f[i - 2] + f[i - 1]); g[i] = 1; } sieve(lim); for (int i = 1; i <= lim; ++i) { constintv(f[i]), iv(ksm(v)); for (int j = 1, k = i; k <= lim; ++j, k += i) if (mu[j] == 1) g[k] = (qe)g[k] * v % mod; elseif (mu[j] == -1) g[k] = (qe)g[k] * iv % mod; } int ans = 1; for (int i = 1; i <= lim; ++i) { bool found = false; for (int j = 1, k = i; k <= lim; ++j, k += i) if ((found |= has[k])) break; if (found) ans = (qe)ans * g[i] % mod; } cout < ans < endl; }