#include <bits/stdc++.h>
using namespace std;
long long N;
std::vector<long long> A;
map<pair<int, int>, int> memo[81];
int dfs(int i, int money, int stock) {
  if (i == N) return money;
  auto it = memo[i].find(make_pair(money, stock));
  if (it != memo[i].end()) return it->second;
  auto a = dfs(i + 1, money, stock);
  auto b = dfs(i + 1, money % A[i], stock + money / A[i]);
  auto c = dfs(i + 1, money + stock * A[i], 0);
  auto ret = max({a, b, c});
  memo[i][make_pair(money, stock)] = ret;
  return ret;
}
void solve(long long N_, std::vector<long long> A_) {
  N = N_;
  A = A_;
  cout << dfs(0, 1000, 0) << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}
