#include <bits/stdc++.h>
using namespace std;
const long long N = 80;
long long a[N], n;
map<long long, long long> ans[N];
inline long long solve(long long p, long long l) {
  if (ans[l][p]) {
    return ans[l][p];
  }
  long long mx = p;
  for (long long i = l + 1; i < n; i++) {
    long long ans = p;
    if (a[i] > a[l]) {
      long long x = ans / a[l];
      ans -= (x * a[l]);
      ans += (x * a[i]);
    }
    mx = max(mx, solve(ans, i));
  }
  ans[l][p] = mx;
  return mx;
}
int32_t main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  cout << solve(1000, 0);
}
