#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> v1;
vector<int> v2;
int rest[300002 * 4];
int need[300002 * 4];
int ar[300002];
inline void init(int b, int l, int r) {
  if (l + 1 == r) {
    need[b] = ar[l];
    return;
  }
  init(b * 2 + 1, l, (l + r) >> 1);
  init(b * 2 + 2, (l + r) >> 1, r);
  need[b] = need[b * 2 + 1] + need[b * 2 + 2];
}
int sum;
inline void add(int b, int l, int r, int ll, bool flag) {
  if (r <= ll || ll < l) {
    return;
  }
  if (l + 1 == r) {
    if (flag) {
      sum += ar[l] / 10;
      rest[b] = ar[l] / 10;
      need[b] = 0;
    } else {
      sum -= ar[l] / 10;
      need[b] = ar[l];
      rest[b] = 0;
    }
    return;
  }
  if (((l + r) >> 1) > ll) {
    add(b * 2 + 1, l, (l + r) >> 1, ll, flag);
  } else {
    add(b * 2 + 2, (l + r) >> 1, r, ll, flag);
  }
  int dc = min(need[b * 2 + 2], rest[b * 2 + 1]);
  need[b] = need[b * 2 + 2] + need[b * 2 + 1] - dc;
  rest[b] = rest[b * 2 + 2] + rest[b * 2 + 1] - dc;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    if (a == 1000) {
      v1.push_back(i);
    } else {
      v2.push_back(i);
    }
    ar[i] = a / 100;
  }
  init(0, 0, n);
  int lef = -1;
  int maxi = 0;
  for (int i = 0; i < v2.size(); i++) {
    int be = sum - rest[0];
    add(0, 0, n, v2[i], true);
    int go = sum - rest[0];
    if (be > go) {
      add(0, 0, n, v2[i], false);
      break;
    } else {
      lef = i;
    }
  }
  maxi = sum - rest[0];
  for (int i = 0; i < v1.size(); i++) {
    add(0, 0, n, v1[i], true);
    while (lef >= 0) {
      int be = sum - rest[0];
      add(0, 0, n, v2[lef], false);
      int go = sum - rest[0];
      if (be <= go) {
        lef--;
      } else {
        add(0, 0, n, v2[lef], true);
        break;
      }
    }
    maxi = max(maxi, (int)sum - rest[0]);
  }
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += (long long int)(ar[i] * 100);
  }
  ans -= (long long int)(maxi)*100LL;
  printf("%lld\n", ans);
  return 0;
}
