#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1, 0);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int cur = 1000;
  int prev = 100000;
  vector<vector<int> > vec;
  for (int i = 0; i <= n; ++i) {
    if (prev > a[i]) {
      vector<int> tmp;
      vec.push_back(tmp);
    }
    vec.back().push_back(a[i]);
    prev = a[i];
  }
  for (auto& it : vec) {
    for (auto i : it) cout << i << " ";
    cout << endl;
  }
  for (auto& it : vec) {
    if (it.size() < 2) continue;
    if (it[0] > cur) continue;
    cur = cur % it[0] + (cur / it[0]) * it.back();
  }
  cout << cur;
}
