#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e9 + 7);
long long modpow(long long a, long long b) {
  if (!b) return 1;
  a %= mod;
  return modpow(a * a % mod, b / 2) * (b & 1 ? a : 1) % mod;
}
long long G(long long x, vector<long long> &arr) {
  int n = arr.size();
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += x / arr[i];
    x %= arr[i];
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long ans = -1;
  for (int i = 0; i < n; i++)
    if (i)
      for (int j = i; j <= n - 1; j++) {
        long long need = arr[i - 1] - 1;
        long long sum = 0;
        long long cnt = 0;
        for (int k = 0; k <= j; k++) {
          cnt += need / arr[k];
          sum += arr[k] * (need / arr[k]);
          need %= arr[k];
        }
        sum += arr[j];
        cnt++;
        if (cnt < G(sum, arr)) {
          if (ans == -1) ans = sum;
          ans = min(ans, sum);
        }
      }
  cout << ans << endl;
  return 0;
}
