#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const long long inf = 1e9;
const long long inf64 = 1e18;
const long long MOD = inf + 7;
long long a[88];
long long n;
map<pair<long long, pair<long long, long long> >, long long> dp;
long long solve(long long money, long long stock, long long id) {
  if (id == n + 1) {
    return a[n] * stock + money;
  }
  auto x = make_pair(money, make_pair(stock, id));
  if (dp.find(x) != dp.end()) {
    return dp[x];
  }
  long long res = solve(money, stock, id + 1);
  res = max(res, solve(money + stock * a[id], 0, id + 1));
  res = max(res, solve(money % a[id], stock + money / a[id], id + 1));
  dp[x] = res;
  return res;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i < n + 1; i++) cin >> a[i];
  cout << solve(1000, 0, 1);
}
