#include <bits/stdc++.h>
template <class T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
template <class T>
void view(T e) {
  cout << e << endl;
}
template <class T>
void view(const vector<T> &v) {
  for (const auto &e : v) {
    cout << e << " ";
  }
  cout << endl;
}
template <class T>
void view(const vector<vector<T>> &vv) {
  for (const auto &v : vv) {
    view(v);
  }
}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int, int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;
int n;
vint a;
int dfs(int date = 0, int n_stock = 0, int posses = 1000) {
  if (date == n) return posses;
  int res = -1;
  res = max(res, dfs(date + 1, n_stock, posses));
  res = max(res, dfs(date + 1, 0, posses + n_stock * a[date]));
  res = max(res, dfs(date + 1, n_stock + posses / a[date],
                     posses - a[date] * (posses / a[date])));
  return res;
}
int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  int ans = dfs();
  cout << ans << endl;
}
