#include <bits/stdc++.h>
const int N = 4e2 + 10;
int n, s[N], tot = -1, best, tanx, w, t;
bool o;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", s + i);
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      best = 1, tanx = 0, w = s[i] - 1;
      for (int k = i + 1; k <= j; ++k) {
        best += (w / s[k]), w %= s[k];
      }
      w = s[i] - 1 - w + s[j];
      t = w;
      for (int k = 1; k <= n; ++k) tanx += (w / s[k]), w %= s[k];
      if (best < tanx) {
        if (!o || tot > t) tot = t, o = true;
      }
    }
  }
  printf("%d", tot);
  return 0;
}
