#include <bits/stdc++.h>
using namespace std;
const double PI = atan(1) * 4;
const long long oo = 1000000000;
const int N = 300010;
int n, a[N], mx = 0;
bool take[N];
bool tr() {
  long long bonus = 0;
  for (int i = 0; i < n; ++i) {
    if (take[i]) {
      bonus += a[i] / 10;
    } else {
      bonus -= min(bonus, (long long)a[i]);
    }
  }
  return bonus == 0;
}
bool check(int mid) {
  memset(take, 0, sizeof take);
  int rem = mx - mid, last = -1, nxt = -1;
  bool bf = true;
  for (int i = 0; i < n; ++i) {
    if (!rem) break;
    if (rem == 1 && a[i] == 2000 && bf) {
      bf = 0;
      for (int j = i; j < n; j++) {
        if (a[j] == 1000) {
          nxt = j;
          break;
        }
      }
      if (last != -1 && nxt != -1 && bf) {
        take[last] = take[nxt] = 1;
        if (tr()) return true;
      }
      if (last != -1) {
        take[last] = take[nxt] = 0;
        take[i] = 1;
        if (tr()) return true;
      }
    }
    if (a[i] == 1000) last = i;
    if (rem >= a[i] / 1000) {
      take[i] = 1;
      rem -= a[i] / 1000;
    }
  }
  return tr();
}
int main() {
  scanf("%d", &n);
  bool fn = true;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    if (a[i] == 1000) fn = 0;
    mx += (a[i] / 100);
  }
  int best = 1e9;
  for (int o2 = 1 + fn; o2 <= 2; o2++) {
    int lo = 0, hi = mx / o2;
    while (lo <= hi) {
      int md = (lo + hi) / 2;
      if (check(md * o2)) {
        best = min(best, md * o2 * 100);
        hi = md - 1;
      } else {
        lo = md + 1;
      }
    }
  }
  cout << best << endl;
  return 0;
}
