#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2100000;
const int inf = 0x3f3f3f3f;
int f[100][1100], n, a[Maxn];
signed main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= 1000; j++) f[i][j] = -1;
  f[0][0] = 1000;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= 1000; j++)
      if (f[i - 1][j] >= 0)
        for (int k = 0; k <= 1000; k++)
          if (j > k)
            (f[i][k] = max(f[i][k], f[i - 1][j] + a[i] * (j - k)));
          else if (f[i - 1][j] >= (k - j) * a[i])
            (f[i][k] = max(f[i][k], f[i - 1][j] + a[i] * (j - k)));
  printf("%d\n", f[n][0]);
  return 0;
}
