#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int max_profit = 0;
  for (int bit = 0; bit < (1 << N); ++bit) {
    int have_money = 1000;
    int have_kabu = 0;
    for (int i = 0; i < N; ++i) {
      if (bit & (1 << i)) {
        if (have_kabu > 0) {
          int kabuka = vec[i];
          have_money += kabuka * have_kabu;
          have_kabu = 0;
        }
      } else {
        if (have_money > 0) {
          int kabuka = vec[i];
          have_kabu += have_money / kabuka;
          have_money = (have_money % kabuka);
        }
      }
    }
    if (have_money > max_profit) {
      max_profit = have_money;
    }
  }
  cout << max_profit << endl;
  return 0;
}
