#include <bits/stdc++.h>
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;
int main() {
  int N;
  cin >> N;
  vec<int> A(N);
  for (ll i = 0; i < (N); i++) cin >> A[i];
  vec<vec<ll>> dp(N + 1, vec<ll>(51, -1));
  dp[0][0] = 1000;
  for (ll i = 0; i < (N); i++)
    for (ll j = 0; j < (50); j++) {
      if (dp[i][j] == -1) continue;
      int price = A[i];
      for (int k = 0; dp[i][j] - k * price >= 0; k++) {
        dp[i + 1][j + k] = max(dp[i + 1][j + k], dp[i][j] - k * price);
      }
      for (int k = 0; k <= j; k++) {
        dp[i + 1][j - k] = max(dp[i + 1][j - k], dp[i][j] + k * price);
      }
    }
  cout << dp[N][0] << endl;
}
