#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a(80);
int maxi = 0;
void solve(int day, int money, int stocks) {
  if (day == n + 1)
    maxi = max(money, maxi);
  else {
    if (stocks == 0) {
      solve(day + 1, money, stocks);
      for (int i = 1; i <= money / a[day - 1]; i++) {
        solve(day + 1, money - a[day - 1] * i, stocks + i);
      }
    } else {
      for (int i = 1; i <= stocks; i++) {
        solve(day + 1, money + a[day - 1] * i, stocks - i);
      }
      for (int i = 1; i <= money / a[day - 1]; i++) {
        solve(day + 1, money - a[day - 1] * i, stocks + i);
      }
      solve(day + 1, money, stocks);
    }
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  solve(1, 1000, 0);
  cout << maxi;
  return 0;
}
