#include <bits/stdc++.h>
using namespace std;
int N, A[450];
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) scanf("%d", &A[i]);
  int ans = -1;
  for (int i = 2; i <= N; i++) {
    for (int j = i; j <= N; j++) {
      int cnt1 = 1, w = A[i - 1] - 1;
      for (int k = i; k <= j; k++) {
        int temp = w / A[k];
        w -= temp * A[k];
        cnt1 += temp;
      }
      w = A[i - 1] - 1 - w + A[j];
      int cnt2 = 0, cur = w;
      for (int k = 1; k <= N; k++) {
        int temp = cur / A[k];
        cur -= temp * A[k];
        cnt2 += temp;
      }
      if (cnt2 > cnt1)
        if (ans == -1 || ans > w) ans = w;
    }
  }
  printf("%d\n", ans);
  return 0;
}
