#include <bits/stdc++.h>
const long long MAX = 200005;
const long long SQN = 330;
const long long LG = 22;
const double PI = atan(1) * 4;
using namespace std;
long long n;
long long a[81];
map<pair<long long, long long>, long long> dp[81];
long long f(long long pos, long long rem, long long stocks) {
  if (pos == n) {
    return rem;
  }
  if (dp[pos].find({rem, stocks}) != dp[pos].end())
    return dp[pos][{rem, stocks}];
  long long ans = f(pos + 1, rem + stocks * a[pos], 0);
  long long buy = rem / a[pos];
  ans = max(ans, f(pos + 1, rem % a[pos], buy));
  ans = max(ans, f(pos + 1, rem, stocks));
  return dp[pos][{rem, stocks}] = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  cout << f(0, 1000, 0);
}
