#include <bits/stdc++.h>
using namespace std;
using ll = long long;
map<vector<int>, int> dp;
vector<int> v;
int n;
int solve(int day, int cur_money, int stocks) {
  if (day == n) {
    return cur_money;
  }
  if (dp.find({day, cur_money, stocks}) != dp.end())
    return dp[{day, cur_money, stocks}];
  int res = solve(day + 1, cur_money, stocks);
  int max_stocks = cur_money / v[day];
  for (int i = 1; i <= max_stocks; i++) {
    if (cur_money >= i * v[day])
      res = max(res, solve(day + 1, cur_money - (i * v[day]), stocks + i));
  }
  for (int i = 1; i <= stocks; i++) {
    res = max(res, solve(day + 1, cur_money + (v[day] * i), stocks - i));
  }
  return dp[{day, cur_money, stocks}] = res;
}
void testcase() {
  cin >> n;
  v = vector<int>(n);
  for (auto &it : v) cin >> it;
  cout << solve(0, 1000, 0);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  if (0) cin >> t;
  while (t--) {
    testcase();
  }
  return 0;
}
