#include <bits/stdc++.h>
using namespace std;
template <class T>
inline istream& operator>>(istream& c, vector<T>& A) {
  for (int i = 0; i < (A.size()); ++i) c >> A[i];
  return c;
}
const long long linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  int ans = 1000;
  function<void(int, int, int, int)> Dfs = [&](int v, int now_y, int now_c,
                                               int turn) {
    ans = max(ans, now_y + now_c * a[v]);
    if (turn) {
      for (int i = v + 1; i < n; ++i) {
        if (a[i] < a[v]) {
          Dfs(i, now_y + now_c * a[v], 0, 0);
        }
      }
    } else {
      for (int i = v + 1; i < n; ++i) {
        if (a[i] > a[v]) {
          Dfs(i, now_y % a[v], now_c + now_y / a[v], 1);
        }
      }
    }
  };
  Dfs(0, 1000, 0, 0);
  cout << ans << endl;
  return 0;
}
