#include <bits/stdc++.h>
using namespace std;
clock_t time_p = clock();
void time_taken() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
const long long mod = 1e9 + 7;
const long long INF = 1e18;
const int maxn = 1e5 + 5;
int dp[100][maxn];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  set<tuple<int, int, int>> vis;
  int ans = 0;
  function<void(int, int, int)> go = [&](int pos, int money, int stocks) {
    if (pos == n) {
      ans = max(ans, money);
      return;
    }
    if (vis.count({pos, money, stocks})) return;
    int s = stocks, m = money;
    go(pos + 1, m + s * a[pos], 0);
    go(pos + 1, m % a[pos], s + m / a[pos]);
    go(pos + 1, money, stocks);
  };
  go(0, 1000, 0);
  cout << ans << '\n';
  time_taken();
  return 0;
}
