#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int MOD = inf + 7;
int a[88];
int n;
int dp[2222][111][81];
int solve(int money, int stock, int id) {
  if (id == n + 1) {
    return a[n] * stock + money;
  }
  int &res = dp[money][stock][id];
  if (res != -1) return res;
  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));
  return res;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n + 1; i++) cin >> a[i];
  memset(dp, -1, sizeof(dp));
  cout << solve(1000, 0, 1);
}
