#include <bits/stdc++.h>
using namespace std;
const int N = 405;
template <class T>
void chkMin(T &x, const T &y) {
  if (y < x) x = y;
}
int n;
int a[N], diff[N], tot, ans;
int calc(int x) {
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    res += x / a[i];
    x %= a[i];
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  ans = INT_MAX;
  for (int i = 2; i <= n; ++i)
    for (int j = i; j <= n; ++j) {
      int tmp = a[i - 1] - 1, cnt1 = 1, w = a[j];
      for (int k = 1; k <= j; ++k) {
        int t = tmp / a[k];
        tmp %= a[k];
        cnt1 += t;
        w += t * a[k];
      }
      int cnt2 = 0;
      tmp = w;
      for (int k = 1; k <= n; ++k) {
        cnt2 += tmp / a[k];
        tmp %= a[k];
      }
      if (cnt1 < cnt2) chkMin(ans, w);
    }
  if (ans == INT_MAX) {
    puts("-1");
  } else {
    printf("%d", ans);
  }
  return 0;
}
