#include <bits/stdc++.h>
long long a[100], dp[100][1000];
using namespace std;
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 1000;
  for (long long i = 0; i <= 1000 / a[1]; i++) {
    dp[1][i] = 1000 - a[1] * i;
  }
  for (long long i = 1; i < n; i++) {
    for (long long j = 0; j < 1000; j++) {
      if (dp[i][j] >= 0) {
        long long tmp = dp[i][j] / a[i + 1];
        for (long long k = 0; k <= tmp && j + k < 1000; k++) {
          dp[i + 1][j + k] = max(dp[i + 1][j + k], dp[i][j] - k * a[i + 1]);
        }
        for (long long k = 1; k <= j; k++) {
          dp[i + 1][j - k] = max(dp[i + 1][j - k], dp[i][j] + k * a[i + 1]);
        }
      }
    }
  }
  cout << dp[n][0] << endl;
  return 0;
}
