#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int INF = 1e9;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool valid(int lx, int ux, int ly, int uy, int x, int y) {
  return lx <= x && x < ux && ly <= y && y < uy;
}
long long int power(long long int x, long long int p) {
  if (p == 0) return 1;
  long long int res = power(x * x % mod, p / 2);
  if (p % 2 == 1) res = res * x % mod;
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1, 0);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  int ans = 0;
  for (int s = 0; s < (n); ++s) {
    for (int g = 0; g < (n); ++g) {
      if (s > g) continue;
      int m = 1000 % a[s], k = 1000 / a[s];
      for (int i = int(s); i < (g); i++) {
        if (a[i] > a[i + 1]) {
          m += k * a[i];
          k = 0;
        } else if (a[i] < a[i + 1]) {
          k += m / a[i];
          m = m % a[i];
        }
      }
      m += k * a[g];
      ans = max(ans, m);
    }
  }
  cout << ans << endl;
  return 0;
}
