#include <bits/stdc++.h>
const int lim = 45;
const int N = 300005;
const int INF = 1000000000;
using namespace std;
int n, a[N];
int f[2][lim];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  int now = 0;
  f[now][0] = 0;
  for (int j = 1; j <= 40; ++j) f[now][j] = INF;
  for (int i = 0; i < n; ++i) {
    now ^= 1;
    for (int j = 0; j <= 40; ++j) f[now][j] = INF;
    for (int j = 0; j <= 40; ++j) {
      if (j + a[i + 1] / 1000 <= 40)
        f[now][j + a[i + 1] / 1000] =
            min(f[now][j + a[i + 1] / 1000], f[now ^ 1][j] + a[i + 1]);
      f[now][max(0, j - a[i + 1] / 100)] =
          min(f[now][max(0, j - a[i + 1] / 100)],
              f[now ^ 1][j] + max(a[i + 1] - j * 100, 0));
    }
  }
  int res = INF;
  for (int j = 0; j <= 40; ++j) res = min(res, f[now][j]);
  printf("%d\n", res);
  return 0;
}
