#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 999999999;
void readFromInputFile() {}
const int MAX_N = 81;
map<int, int> DP[MAX_N];
int N;
vector<int> A;
int rec(int i, int kn, int sum) {
  if (DP[i].count(kn) != 0) {
    return DP[i][kn];
  }
  int res;
  if (i == N - 1) {
    res = sum + kn * A[i];
  } else {
    int buyn = sum / A[i];
    res = max({rec(i + 1, kn + buyn, sum - buyn * A[i]), rec(i + 1, kn, sum),
               rec(i + 1, 0, sum + kn * A[i])});
  }
  DP[i][kn] = sum;
  return res;
}
int main() {
  readFromInputFile();
  cin >> N;
  for (int i = 0; i < N; i++) {
    int t;
    cin >> t;
    A.push_back(t);
  }
  cout << rec(0, 0, 1000) << endl;
  return 0;
}
