#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int k;
int a[maxn];
int dp[81][501];
int main() {
  int n;
  cin >> n;
  memset(dp, -0x3f, sizeof(dp));
  dp[0][0] = 1000;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    for (int j = 0; j <= 500; j++) {
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      int k = dp[i][j] / x;
      for (int l = 1; l <= k; l++) {
        dp[i + 1][j + l] = max(dp[i + 1][j + l], dp[i][j] - l * x);
      }
      for (int l = j - 1; l >= 0; l--) {
        dp[i + 1][l] = max(dp[i + 1][l], dp[i][j] + (j - l) * x);
      }
    }
  }
  cout << dp[n][0] << endl;
}
