#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
void chmax(int& a, int b) {
  if (a < b) a = b;
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vecint a(n);
  for (auto& e : a) cin >> e;
  vector<map<int, int>> mp(n + 1);
  mp[0][0] = 1000;
  for (int i = 0; i < (int)n; i++) {
    for (auto& e : mp[i]) {
      int x = e.first;
      int y = e.second;
      for (int k = 0; y - a[i] * k >= 0; k++) {
        chmax(mp[i + 1][x + k], y - a[i] * k);
      }
      for (int k = 1; k <= x; k++) {
        chmax(mp[i + 1][x - k], y + a[i] * k);
      }
    }
  }
  int ans = 0;
  for (auto& e : mp[n]) {
    chmax(ans, e.second);
  }
  cout << ans << endl;
}
