#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
const long long mod = 1000000007;
const long long LINF = 1LL << 62;
const int INF = 1 << 30;
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<bool>> dp(n, vector<bool>(300 * 100, false));
  int mx = 300 * 80;
  dp[0][1000] = true;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      for (int k = mx; k >= 0; k--) {
        if (not dp[i][k]) continue;
        int t = k / a[i];
        if (k + t * (a[j] - a[i]) >= 0) dp[j][k + t * (a[j] - a[i])] = true;
        dp[j][k] = true;
      }
    }
  }
  for (int i = mx; i >= 0; i--) {
    if (dp[n - 1][i]) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}
