#include <bits/stdc++.h>
using namespace std;
int ar[100005];
char ch[100005];
int n, m, k, ii;
long long re;
void func(int i, long long ex, long long koy) {
  if (i == n) {
    long long tot = ex + koy * ar[i];
    re = max(re, tot);
    return;
  }
  long long nibo = ex / ar[i];
  func(i + 1, ex - (nibo * ar[i]), koy + nibo);
  long long val = koy * ar[i];
  func(i + 1, ex + val, 0);
  func(i + 1, ex, koy);
}
void solve() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &ar[i]);
  func(1, 1000, 0);
  printf("%lld\n", re);
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
