#include <bits/stdc++.h>
using namespace std;
int a[100], dp[100][100];
int solve(int st, int en, int mon) {
  if (st >= en) return 0;
  if (dp[st][en] != -1) return dp[st][en];
  int p = 0;
  for (int i = st; i <= en; i++) {
    if (a[i] > mon) continue;
    int stocks = mon / a[i];
    for (int j = i + 1; j <= en; j++) {
      if (a[j] > a[i]) {
        int cur = (a[j] - a[i]) * stocks +
                  solve(st, i - 1, mon + (a[j] - a[i]) * stocks) +
                  solve(j + 1, en, mon + (a[j] - a[i]) * stocks);
        p = max(p, cur);
      }
    }
  }
  return dp[st][en] = p;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) dp[i][j] = -1;
  }
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << solve(0, n - 1, 1000) + 1000;
  return 0;
}
