#include <bits/stdc++.h>
using namespace std;
const int N = 260000 + 5;
int n, m, len;
long long dp[81][N];
int a[N];
long long fun(int idx, long long tk, long long stock = 0LL) {
  if (idx > n) return tk;
  long long r1 = 0, r2 = 0, r3 = 0;
  long long &ret = dp[idx][tk];
  if (-1 != ret) {
    return ret;
  }
  r1 = fun(idx + 1, tk % a[idx], stock + tk / a[idx]);
  r2 = fun(idx + 1, tk + 1LL * stock * a[idx], 0LL);
  r3 = fun(idx + 1, tk, stock);
  return ret = max({r1, r2, r3});
}
void HalfDead() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  memset(dp, -1, sizeof dp);
  cout << fun(1, 1000) << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  int tc = 1;
  while (tc--) {
    HalfDead();
  }
  return 0;
}
