#include <bits/stdc++.h>
using namespace std;
int N, ans, base[2020];
int main() {
  cin >> N;
  ans = -1;
  register int i, j, k;
  for (i = 1; i <= N; ++i) scanf("%d", &base[i]);
  for (i = 2; i <= N; ++i)
    for (j = i; j <= N; ++j) {
      register int c1 = base[i - 1] - 1, cnt = 1, w = base[j];
      for (k = i; k <= j; ++k)
        cnt += c1 / base[k], w += base[k] * (c1 / base[k]), c1 %= base[k];
      for (c1 = w, k = 1; k <= N; ++k) cnt -= c1 / base[k], c1 %= base[k];
      if (cnt < 0 && (ans < 0 || ans > w)) ans = w;
    }
  cout << ans << endl;
  return 0;
}
