#include <bits/stdc++.h>
using namespace std;
long long n, dp[81][209999];
vector<long long> v;
long long calc(long long idx, long long rem, long long wh) {
  if (idx >= n) {
    return rem;
  }
  long long &ret = dp[idx][rem];
  if (ret != -1)
    return ret;
  else
    ret = 0;
  ret = max(ret, calc(idx + 1, rem, wh));
  if ((rem / v[idx]) >= 1)
    ret = max(ret,
              calc(idx + 1, (rem - ((rem / v[idx]) * v[idx])), (rem / v[idx])));
  if (wh) ret = max(ret, calc(idx + 1, wh * v[idx] + rem, 0));
  return ret;
}
void solve() {
  cin >> n;
  v.resize(n);
  for (long long i = 0; i < (n); ++i) cin >> v[i];
  for (long long i = 0; i < (80); ++i)
    for (long long j = 0; j < (209999); ++j) dp[i][j] = -1;
  cout << calc(0, 1000, 0);
}
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
