#include <bits/stdc++.h>
namespace solve {
int V[410];
int n, ans = -1;
int read() {
  int f = 1, x = 0;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') f = -1;
  while (c <= '9' && c >= '0') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return f * x;
}
void init() {
  n = read();
  for (int i = 1; i <= n; i++) V[i] = read();
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int cnt1 = 1, cnt2 = 0, w = V[i] - 1, m;
      for (int k = i + 1; k <= j && w > 0; k++) {
        cnt1 += w / V[k];
        w %= V[k];
      }
      m = V[j] + V[i] - 1 - w;
      w = m;
      for (int k = 1; k <= n && w > 0; k++) {
        cnt2 += w / V[k];
        w %= V[k];
      }
      if (cnt1 < cnt2 && (m < ans || ans == -1)) ans = m;
    }
  }
  printf("%d\n", ans);
}
}  // namespace solve
int main(void) {
  solve::init();
  return 0;
}
