#include <bits/stdc++.h>
using namespace std;
int dp[5000][80][2] = {-1};
void setdp() {
  for (int i = 0; i < 5000; i++)
    for (int j = 0; j < 80; j++)
      for (int k = 0; k < 2; k++) dp[i][j][k] = -1;
}
int find(int money, int stocks, int bors, int* a, int pos, int n, int khareed) {
  if (pos == n) return money;
  if (dp[money][pos][bors] != -1) {
    return dp[money][pos][bors];
  }
  if (bors == 0) {
    int ans1 = find(money, stocks, 0, a, pos + 1, n, khareed);
    int nstocks = stocks + money / a[pos];
    int nmoney = money % a[pos];
    int ans2 = find(nmoney, nstocks, 1, a, pos + 1, n, a[pos]);
    int ans = max(ans1, ans2);
    dp[money][pos][bors] = ans;
    return ans;
  }
  if (bors == 1) {
    int ans1 = find(money, stocks, 1, a, pos + 1, n, khareed);
    int nstocks = 0;
    int ans;
    if (a[pos] > khareed) {
      int nmoney = money + stocks * a[pos];
      int ans2 = find(nmoney, nstocks, 0, a, pos + 1, n, 0);
      ans = max(ans1, ans2);
    } else
      ans = ans1;
    dp[money][pos][bors] = ans;
    return ans;
  }
}
int main() {
  int n;
  cin >> n;
  setdp();
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans = find(1000, 0, 0, a, 0, n, 0);
  cout << ans << endl;
  return 0;
}
