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