#include <bits/stdc++.h>
using namespace std;
long long int maxProfit(long long int price[], long long int start,
                        long long int end, long long int curr) {
  if (end <= start) return 0;
  long long int profit = 0;
  for (int i = start; i < end; i++) {
    for (int j = i + 1; j <= end; j++) {
      if (price[j] > price[i]) {
        long long int ka = curr / price[i];
        long long int curr_profit =
            (price[j] - price[i]) * ka +
            maxProfit(price, j + 1, end, curr + (price[j] - price[i]) * ka);
        profit = max(profit, curr_profit);
      }
    }
  }
  return profit;
}
int main() {
  int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << max(0ll, maxProfit(a, 0, n - 1, 1000)) + 1000;
  return 0;
}
