#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1LL << 60;
const long long MOD = 1000000007;
vector<long long> A;
long long N;
long long f(const pair<long long, long long>& state, const long long day) {
  if (day == N + 1) return state.first;
  const long long value = A[day];
  long long rv0 = f(state, day + 1);
  long long rv1 = -INF;
  long long rv2 = -INF;
  if (state.first >= value) {
    rv1 = f(pair<long long, long long>(state.first % value,
                                       state.second + state.first / value),
            day + 1);
  }
  if (state.second > 0) {
    rv2 = f(pair<long long, long long>(state.first + state.second * value, 0),
            day + 1);
  }
  return max(rv0, max(rv1, rv2));
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  A.resize(N + 1);
  A[0] = 0;
  for (long long i = 0; i < N; ++i) cin >> A[i + 1];
  long long ans = f(pair<long long, long long>(1000, 0), 1);
  cout << ans << endl;
}
