#include <bits/stdc++.h>
using namespace std;
int N;
vector<long long>(A);
;
long long ans = 1000;
void search2(int day, long long money, long long stock) {
  if (day == N) {
    ans = max(ans, money);
    return;
  }
  search2(day + 1, money, stock);
  if (money >= A[day]) {
    search2(day + 1, money % A[day], stock + money / A[day]);
  }
  if (stock > 0) {
    search2(day + 1, money + stock * A[day], 0LL);
  }
}
int main() {
  cin >> N;
  for (int x = 0; x < (N); x++) {
    int aa;
    cin >> aa;
    (A).push_back(aa);
    ;
  }
  search2(0, 1000, 0);
  cout << ans << endl;
  ;
  return 0;
}
