#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 31) - 1;
const int maxn = 400 + 10;
int n;
int c[maxn];
int ans = inf;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0, _n = (int)(n); i < _n; i++) cin >> c[i];
  for (int i = (int)(1), _n = (int)(n); i < _n; i++)
    for (int j = (int)(i), _n = (int)(n); j < _n; j++) {
      int x = c[i - 1] - 1, y = x, z, opt = 1, cnt = 0;
      for (int k = (int)(i), _n = (int)(j + 1); k < _n; k++)
        opt += y / c[k], y %= c[k];
      z = x - y + c[j];
      for (int k = 0, _n = (int)(n); k < _n; k++) cnt += z / c[k], z %= c[k];
      if (opt < cnt) ans = min(ans, x - y + c[j]);
    }
  cout << (ans == inf ? -1 : ans) << endl;
  {
    int _;
    cin >> _;
  }
  return 0;
}
