#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 1000000001, INF = (ll)1e18 + 1;
int n;
ll ans = 0;
vector<int> a;
void calc(int i, int yen, int stocks) {
  yen += stocks * a[i];
  stocks = 0;
  ans = max(ans, (ll)yen);
  for (; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      calc(j, yen % a[i], yen / a[i]);
    }
  }
}
void solve() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    calc(i, 1000, 0);
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
