#include <bits/stdc++.h>
using namespace std;
int n, x[444], ans(-1);
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &x[i]);
  for (int i = 1; i <= n; ++i)
    for (int j = i; j <= n; ++j) {
      int c1(0), c2(0), left(x[i] - 1), val(0);
      for (int k = 1; k <= j; ++k)
        c1 += left / x[k], val += left / x[k] * x[k], left %= x[k];
      ++c1, val += x[j];
      left = val;
      for (int k = 1; k <= n; ++k) c2 += left / x[k], left %= x[k];
      if (c1 < c2 && (ans == -1 || val < ans)) ans = val;
    }
  printf("%d\n", ans);
  return 0;
}
