#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
long long int arr[100];
long long int n;
long long int dp[82][150][3999];
long long int solve(long long int id, long long int stock,
                    long long int money) {
  if (id >= n) return money;
  if (dp[id][stock][money] != -1) return dp[id][stock][money];
  long long int op1 = solve(id + 1, stock + money / arr[id],
                            money - ((money / arr[id]) * arr[id]));
  long long int op2 = solve(id + 1, stock, money);
  long long int op3 = solve(id + 1, 0ll, stock * arr[id] + money);
  return dp[id][stock][money] = max(op1, max(op2, op3));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  memset(dp, -1, sizeof(dp));
  cout << solve(0, 0, 1000ll);
  return 0;
}
