#include using namespace std; using ll = long long int; using lc = complex; int main(void) { constexpr ll MOD = 1e9+7; constexpr double PI = acos(-1); cout << fixed << setprecision(32); cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vector a(n); for(auto &e: a) cin >> e; ll r = 1; bool ng = false; for(ll i=0; i3 || r > MOD) { ng = true; } } if(ng) { cout << MOD << endl; return 0; } cout << ((r) ? (MOD % r) : -1) << endl; return 0; }