#include <bits/stdc++.h>
using namespace std;
int a[105], n;
struct Node {
  int m, s, day, temp;
  Node(int m, int s, int temp, int day) : m(m), s(s), temp(temp), day(day) {}
};
int bfs() {
  queue<Node> q;
  q.push(Node(1000, 0, 1000, 1));
  int Mx = 0;
  while (q.size()) {
    Node now = q.front();
    q.pop();
    Mx = max(Mx, now.m + now.s * a[now.day]);
    if (now.day == n) continue;
    if (now.m >= a[now.day]) {
      int num = now.m / a[now.day];
      int ns = num + now.s;
      int nm = now.m - num * a[now.day];
      q.push(Node(nm, ns, a[now.day], now.day + 1));
    }
    if (now.s > 0 && a[now.day] > now.temp) {
      int nm = now.m + now.s * a[now.day];
      q.push(Node(nm, 0, 1000, now.day + 1));
    }
    q.push(Node(now.m, now.s, now.temp, now.day + 1));
  }
  return Mx;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  printf("%d\n", bfs());
  return 0;
}
