#include <bits/stdc++.h>
using namespace std;
int n;
int a[500], ans = -1;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 2; i <= n; ++i)
    for (int j = i; j <= n; ++j) {
      int A = a[j], B = a[i - 1] - 1, C = 1, D = 0;
      for (int k = i; k <= j; ++k)
        A += B / a[k] * a[k], C += B / a[k], B %= a[k];
      B = A;
      for (int k = 1; k <= n; ++k) D += B / a[k], B %= a[k];
      if (C < D && (ans < 0 || ans > A)) ans = A;
    }
  printf("%d\n", ans);
  return 0;
}
