#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int MAX_N = 1e5 + 1, mod = 1e9 + 7;
int dp[80][2001][201], n;
int arr[80];
int solve(int idx, int curfee, int tosell) {
  if (idx == n) return curfee;
  int &ret = dp[idx][curfee][tosell];
  if (~ret) return ret;
  ret = max(ret, solve(idx + 1, curfee, tosell));
  int profit = tosell * arr[idx];
  int willbuy = curfee / arr[idx];
  int left = curfee - willbuy * arr[idx];
  ret = max({ret, solve(idx + 1, curfee + profit, 0),
             solve(idx + 1, left, tosell + willbuy)});
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", arr + i);
  memset(dp, -1, sizeof(dp));
  printf("%d", solve(0, 1000, 0));
}
