#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n], ma[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  fill(ma, ma + n, 1000);
  for (long long i = 0; i < n; i++) {
    for (long long j = i; j < n; j++) {
      for (long long k = j + 1; k < n; k++) {
        ma[k] = max(ma[k], ma[i] / a[j] * a[k] + ma[i] % a[j]);
      }
    }
  }
  printf("%lld\n", ma[n - 1]);
}
