#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;
template <typename T1, typename T2>
inline void chmin(T1 &a, const T2 &b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, const T2 &b) {
  if (a < b) a = b;
}
lint dp[100][20000];
int main() {
  lint n;
  cin >> n;
  vector<lint> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 100; i++)
    for (int j = 0; j < 20000; j++) dp[i][j] = -INF;
  dp[0][1000] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 20000; j++) {
      if (dp[i][j] == -INF) continue;
      {
        lint nj = j + dp[i][j] * a[i];
        dp[i + 1][nj] = max(dp[i + 1][nj], 0LL);
      }
      {
        lint nj = j % a[i];
        lint add = j / a[i];
        dp[i + 1][nj] = max(dp[i + 1][nj], dp[i][j] + add);
      }
    }
  }
  lint ans = -INF;
  for (lint j = 0; j < 20000; j++) {
    if (dp[n][j] == -INF) continue;
    ans = max(ans, j);
  }
  cout << ans << endl;
  return 0;
}
