#include <bits/stdc++.h>
using namespace std;
void IO() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
const int N = 2e6 + 3, M = 5e3 + 5, mod = 1e9 + 7, dx[] = {1, -1, 0, 0},
          dy[] = {0, 0, 1, -1};
const double eps = 1e-9;
int n, m, k, tc, ans, a[N];
int dp[81][10005][205];
int solve(int idx = 0, int cur = 1000, int stock = 0) {
  if (idx >= n) return cur;
  int& r = dp[idx][cur][stock];
  if (~r) return r;
  r = max(solve(idx + 1, cur, stock), solve(idx + 1, cur + a[idx] * stock, 0));
  r = max(r, solve(idx + 1, cur % a[idx], stock + cur / a[idx]));
  return r;
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  printf("%d\n", solve());
}
