#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
void solve(int test) {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int& e : a) cin >> e;
  vector<int> small(n, -1), big(n, -1);
  for (int i = 0; i < n; i++) {
    for (int j = n - 1; j > i; j--) {
      if (a[j] < a[i]) small[i] = j;
      if (a[j] > a[i]) big[i] = j;
    }
  }
  int ans = 0;
  for (int pos = 0; pos < n; pos++) {
    int res = 1000, id = pos;
    int stocks = res / a[pos], funds = res % a[pos];
    while (true) {
      int j = big[id];
      if (j == -1) break;
      funds += a[j] * stocks;
      stocks = 0;
      res = max(res, funds);
      int k = small[j];
      if (k == -1) break;
      stocks = funds / a[k];
      funds %= a[k];
      id = k;
    }
    ans = max(ans, res);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve(i);
    cout << "\n";
  }
}
