#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 405;
int n, ans = -1;
int c[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  for (int i = 2; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      int p = c[i - 1] - 1, cnt = 1, w = c[j];
      for (int k = i; k <= j; k++) {
        cnt += p / c[k];
        w += p / c[k] * c[k];
        p %= c[k];
      }
      p = w;
      for (int k = 1; k <= n; k++) {
        cnt -= p / c[k];
        p %= c[k];
      }
      if (cnt < 0 && (ans == -1 || w < ans)) ans = w;
    }
  }
  printf("%d\n", ans);
  return 0;
}
