#include <bits/stdc++.h>
using namespace std;
map<int, map<pair<long long, long long>, bool>> dp;
pair<long long, long long> P, tmp;
int main(void) {
  int N, day = 0, ans = -1000;
  cin >> N;
  vector<int> A(N + 5, 0);
  vector<queue<pair<long long, long long>>> que(N + 5);
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
  }
  P = make_pair(1000, 0);
  if (dp[day + 1][P] == false) {
    que[day + 1].push(P);
    dp[day + 1][P] = true;
  }
  day = 1;
  while (day <= N) {
    P = que[day].front();
    que[day].pop();
    tmp = P;
    int kabu = tmp.second + tmp.first / A[day];
    long long kane = tmp.first - A[day] * (tmp.first / A[day]);
    if (day == N) {
      if (kane > ans) {
        ans = kane;
      }
    } else {
      tmp = make_pair(kane, kabu);
      if (dp[day + 1][tmp] == false) {
        que[day + 1].push(tmp);
        dp[day + 1][tmp] = true;
      }
    }
    tmp = P;
    kabu = 0;
    kane = P.first + A[day] * P.second;
    if (day == N) {
      if (kane > ans) {
        ans = kane;
      }
    } else {
      tmp = make_pair(kane, kabu);
      if (dp[day + 1][tmp] == false) {
        que[day + 1].push(tmp);
        dp[day + 1][tmp] = true;
      }
    }
    tmp = P;
    if (day == N) {
      if (kane > ans) {
        ans = kane;
      }
    } else {
      if (dp[day + 1][tmp] == false) {
        que[day + 1].push(tmp);
        dp[day + 1][tmp] = true;
      }
    }
    if (que[day].size() <= 0) {
      day++;
    }
  }
  cout << ans << endl;
  return 0;
}
