#include <bits/stdc++.h>
using namespace std;
int N;
int a[81];
int stock(int cnt, int n, int money) {
  if (n == N) return money;
  if (n == N - 1)
    return money + (cnt * a[n]);
  else {
    if (cnt > 0)
      return max(stock(0, n + 1, money + (cnt * a[n])),
                 stock(cnt, n + 1, money));
    return max(stock(money / a[n], n + 1, money % a[n]),
               stock(0, n + 1, money));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  {
    long long int sum = 0, ans = 1, f = 1, n, m, k, x, y, z;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> a[i];
    ;
    cout << stock(0, 0, 1000);
    cout << '\n';
  }
  return 0;
}
