#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
int n;
int arr[85];
int dp[85][1000][1601];
int solve(int pos, int stock, int taka) {
  if (pos > n) return taka;
  if (dp[pos][stock][taka] != -1) return dp[pos][stock][taka];
  int a, b, c;
  int sell = stock * arr[pos];
  int buy = taka / arr[pos];
  int rem = taka - (buy * arr[pos]);
  a = solve(pos + 1, stock, taka);
  b = solve(pos + 1, buy, rem);
  c = solve(pos + 1, 0, taka + sell);
  return dp[pos][stock][taka] = max(a, max(b, c));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int a, b, c, i, j, k, t, m;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> arr[i];
  memset(dp, -1, sizeof(dp));
  cout << solve(1, 0, 1000) << endl;
  return 0;
}
