#include <bits/stdc++.h>
using namespace std;
int N, A[410];
int g[410];
int greedy(int x) {
  int res = 0;
  for (int i = 0; i < (int)(N); i++) {
    res += g[i] = x / A[i];
    x %= A[i];
  }
  return res;
}
int counter_example() {
  int res = INT_MAX;
  for (int i = 0; i < (int)(N); i++) {
    for (int j = i + 1; j < N; ++j) {
      greedy(A[i] - 1);
      int x = 0, y = 0;
      for (int k = i + 1; k <= j; ++k) {
        y += g[k];
        x += g[k] * A[k];
      }
      ++y;
      x += A[j];
      if (y < greedy(x)) {
        res = min(res, x);
      }
    }
  }
  return res == INT_MAX ? -1 : res;
}
int main() {
  while (1 == scanf("%d", &N)) {
    for (int i = 0; i < (int)(N); i++) scanf("%d", A + i);
    printf("%d\n", counter_example());
  }
  return 0;
}
