#include <bits/stdc++.h>
using namespace std;
int a[402];
int main() {
  int n = 0;
  memset(a, 0, sizeof(a));
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  int res = -1;
  for (int i = 1; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      int r = a[i - 1] - 1;
      int cnt = 1;
      int w = a[j];
      for (int k = i; k <= j; ++k) {
        cnt += r / a[k];
        w += r / a[k] * a[k];
        r %= a[k];
      }
      r = w;
      for (int k = 0; k < n; ++k) {
        cnt -= r / a[k];
        r %= a[k];
      }
      if (cnt < 0 && (res == -1 || w < res)) {
        res = w;
      }
    }
  }
  cout << res << endl;
  return 0;
}
