#include <bits/stdc++.h>
using namespace std;
using lint = long long;
int a[444];
void solve(istream& cin, ostream& cout) {
  int n;
  cin >> n;
  for (int i = (0); i < int(n); ++i) {
    cin >> a[i];
  }
  int ans = 2e9;
  for (int i = (0); i < int(n - 1); ++i) {
    for (int j = (i + 1); j < int(n); ++j) {
      int t = a[i] - 1;
      int c = 0;
      int x = 0;
      for (int k = (0); k < int(j + 1); ++k) {
        int y = t / a[k];
        t %= a[k];
        c += y;
        x += a[k] * y;
      }
      x += a[j];
      c++;
      int ox = x;
      int g = 0;
      for (int k = (0); k < int(n); ++k) {
        g += x / a[k];
        x %= a[k];
      }
      if (c < g) {
        ans = min(ans, ox);
      }
    }
  }
  cout << (ans == 2e9 ? -1 : ans);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve(cin, cout);
  return 0;
}
