#include <bits/stdc++.h>
int i, n, a[401], ans, s, t, m, d, j, k;
int main() {
  scanf("%d", &n);
  ans = -1;
  for (i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (i = 1; i <= n; ++i)
    for (j = i; j <= n; ++j) {
      s = a[i] - 1;
      t = 1;
      m = a[j];
      for (k = i + 1; k <= j; ++k) {
        t += s / a[k];
        m += s / a[k] * a[k];
        s %= a[k];
      }
      d = m;
      for (k = 1; k <= n; ++k) {
        t -= d / a[k];
        d %= a[k];
      }
      if ((t < 0) && ((ans == -1) || (m < ans))) ans = m;
    }
  printf("%d\n", ans);
}
