#include <bits/stdc++.h>
using namespace std;
int n, a[1008];
int ans = 1e9;
struct Tprogram {
  void open() {
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
  }
  void close() {
    fclose(stdin);
    fclose(stdout);
  }
  void init() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  }
  void work() {
    for (int i = 2; i <= n; i++) {
      int m = a[i - 1] - 1;
      int cnt = 1, y, s = 0;
      for (int j = i; j <= n; j++) {
        int p = m / a[j];
        m = m - p * a[j];
        cnt += p;
        s += p * a[j];
        y = 0;
        for (int s1 = s + a[j], k = 1; k <= n && s1; k++)
          if (s1 >= a[k]) y += s1 / a[k], s1 %= a[k];
        if (y > cnt) ans = (ans < s + a[j] ? ans : s + a[j]);
      }
    }
    if (ans >= 1e9)
      printf("-1\n");
    else
      printf("%d\n", ans);
  }
} Program;
int main() {
  Program.init();
  Program.work();
  return 0;
}
