#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); ++i) {
    cin >> a.at(i);
  }
  vector<int> b(n - 1);
  for (int i = 0; i < (n - 1); ++i) {
    if (a.at(i + 1) >= a.at(i))
      b.at(i) = 1;
    else {
      b.at(i) = 0;
    }
  }
  vector<int> c(n - 1);
  for (int j = 0; j < (n - 2); ++j) {
    if (b.at(j) != b.at(j + 1) && b.at(j) == 1) {
      c.at(j) = 9;
    } else if (b.at(j) != b.at(j + 1) && b.at(j) == 0) {
      c.at(j) = 8;
    }
  }
  if (b.at(n - 2) == 1) {
    c.at(n - 2) = 9;
  } else {
    c.at(n - 2) = 8;
  }
  for (int i = 0; i < (n - 1); ++i) {
    if (b.at(i) == 1) {
      c.at(i) = 7;
      break;
    }
  }
  int ans = 1000;
  int kabu = 0;
  int max = 0;
  if (n == 2) {
    if (b.at(0) == 1) {
      max = 1000 % a.at(0) + a.at(1) * (1000 / a.at(0));
    } else {
      max = 1000;
    }
  } else {
    for (int i = 0; i < (n - 1); ++i) {
      if (c.at(i) == 7) {
        kabu += ans / a.at(i);
        ans = ans % a.at(i);
        c.at(i) = 9;
      }
      if (c.at(i) == 8) {
        kabu += ans / a.at(i + 1);
        ans = ans % a.at(i + 1);
      }
      if (c.at(i) == 9) {
        ans += kabu * a.at(i + 1);
        kabu = 0;
      }
      if (max < ans) {
        max = ans;
      }
    }
  }
  cout << max << endl;
}
