#include <bits/stdc++.h>
int dx[] = {0, -1, 0, 1, -1, 1, -1, 1};
int dy[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int MOD = 1e9 + 7, N = 2e6 + 5, oo = 1e9;
const double pi = acos(-1);
using namespace std;
long long n, arr[100], dp[81][5005][500];
long long solve(int id, long long money, long long candies) {
  if (id == n) return 0;
  long long ans = 0;
  if (~dp[id][money][candies]) return dp[id][money][candies];
  ans = max(ans, solve(id + 1, money, candies));
  if (money >= arr[id])
    ans = max(ans, solve(id + 1, money - ((money / arr[id]) * arr[id]),
                         candies + (money / arr[id])) -
                       ((money / arr[id]) * arr[id]));
  if (candies)
    ans = max(ans, solve(id + 1, money + (candies * arr[id]), 0) +
                       (candies * arr[id]));
  return dp[id][money][candies] = ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof dp);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  cout << 1000 + solve(0, 1000, 0);
  return 0;
}
