#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
vector<map<i64, i64>> memo(81);
i64 dfs(i64 m, i64 k, i64 d, i64 N, vector<i64> &A) {
  if (d == N) return m;
  if (memo[d].count(d) != 0 && m < memo[d][k]) return memo[d][k];
  i64 ret = 0;
  ret = max(ret, dfs(m + k * A[d], 0, d + 1, N, A));
  ret = max(ret, dfs(m - m / A[d] * A[d], k + m / A[d], d + 1, N, A));
  return memo[d][k] = ret;
}
int main() {
  i64 N;
  cin >> N;
  vector<i64> A(N);
  for (i64 i = 0; i < N; i++) cin >> A[i];
  cout << dfs(1000, 0, 0, N, A) << "\n";
  return 0;
}
