#include <bits/stdc++.h>
using namespace std;
int n, data[405], num[405];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &data[i]);
  int ans = -1;
  for (int i = 1; i < n; i++)
    for (int j = i; j < n; j++) {
      int t = data[i - 1] - 1, tol1 = 0, tol2 = 0;
      memset(num, 0, sizeof(num));
      for (int k = 0; k < n; k++) num[k] = t / data[k], t %= data[k];
      num[j]++;
      t = 0;
      for (int k = 0; k <= j; k++) {
        t += data[k] * num[k];
        tol1 += num[k];
      }
      int g = t;
      for (int k = 0; k < n; k++) tol2 += t / data[k], t %= data[k];
      if (tol1 < tol2 && (ans == -1 || g < ans)) ans = g;
    }
  printf("%d\n", ans);
  return 0;
}
