#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &n) {
  int x = 1;
  char c = getchar();
  n = 0;
  for (; !isdigit(c); c = getchar())
    if (c == '-') x = -x;
  for (; isdigit(c); c = getchar()) n = n * 10 + (c ^ 48);
  n *= x;
}
inline int min(int x, int y) { return x < y ? x : y; }
int n, a[401], ans = -1;
int main() {
  read(n);
  for (int i = 1; i <= n; i++) {
    read(a[i]);
  }
  for (int i = 2; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      int cnt = 1, mon = a[i - 1] - 1, now = a[j];
      for (int k = i; k <= j; k++) {
        cnt += mon / a[k];
        now += (mon / a[k]) * a[k];
        mon %= a[k];
      }
      mon = now;
      for (int k = 1; k <= n; k++) {
        cnt -= mon / a[k];
        mon %= a[k];
      }
      if (cnt < 0) {
        if (ans == -1)
          ans = now;
        else
          ans = min(ans, now);
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
