#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < (int)(N); i++) {
    cin >> A[i];
  }
  vector<vector<long long>> dp(N + 1, vector<long long>(3, 0));
  vector<vector<long long>> stock_num(N + 1, vector<long long>(3, 0));
  for (int i = 0; i < (int)(3); i++) {
    dp[0][i] = 1000;
  }
  for (int i = 0; i < (int)(N); i++)
    for (int j = 0; j < (int)(3); j++)
      for (int nj = 0; nj < (int)(3); nj++) {
        if (dp[i + 1][nj] < dp[i][j]) {
          dp[i + 1][nj] = dp[i][j];
          stock_num[i + 1][nj] = stock_num[i][j];
        }
        if (nj == 1) {
          long long buy_count = dp[i][j] / A[i];
          long long n_stock = stock_num[i][j] + buy_count;
          if (stock_num[i + 1][nj] < n_stock) {
            stock_num[i + 1][nj] = n_stock;
            dp[i + 1][nj] = dp[i][j] - (buy_count * A[i]);
          }
        }
        if (nj == 2) {
          long long money = stock_num[i][j] * A[i];
          long long n_money = dp[i][j] + money;
          if (dp[i + 1][nj] < n_money) {
            dp[i + 1][nj] = n_money;
            stock_num[i + 1][nj] = 0;
          }
        }
      }
  long long ans = 0;
  for (int i = 0; i < (int)(N + 1); i++)
    for (int j = 0; j < (int)(3); j++) {
      ans = max(dp[i][j], ans);
    }
  cout << ans << endl;
  return 0;
}
