#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int num[205];
int maxn = 0;
int n;
void dfs(int day, int con, int mo) {
  if (day == n + 1) {
    if (mo > maxn) maxn = mo;
    return;
  }
  if (mo >= num[day]) {
    int a = mo / num[day];
    dfs(day + 1, con + a, mo - a * num[day]);
  }
  dfs(day + 1, con, mo);
  if (con != 0) dfs(day + 1, 0, mo + con * num[day]);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> num[i];
  dfs(1, 0, 1000);
  cout << maxn << endl;
}
