#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int n;
map<pair<int, pair<long long, int>>, long long> mp;
long long brute(int day, long long money, int stock) {
  if (day == n) return money;
  if (mp.find({day, {money, stock}}) != mp.end())
    return mp[{day, {money, stock}}];
  long long a = 0, b = 0, c = 0;
  if (money)
    a = brute(day + 1, money - (money / v[day]) * v[day],
              stock + money / v[day]);
  if (stock) b = brute(day + 1, money + stock * v[day], 0);
  c = brute(day + 1, money, stock);
  return (mp[{day, {money, stock}}] = max({a, b, c}));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  v = vector<long long>(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  cout << brute(0, 1000, 0) << endl;
  return 0;
}
