#include <bits/stdc++.h>
using namespace std;
int n, x, f[3500], g[3500], ans = 1e9, maxn = 3000;
int main() {
  scanf("%d", &n);
  memset(f, 127, sizeof(f));
  f[0] = 0;
  for (int i = 1; i <= n; i++) {
    memcpy(g, f, sizeof(f));
    memset(f, 127, sizeof(f));
    scanf("%d", &x);
    for (int j = 0; j <= maxn; j += 100)
      f[j + x / 10] = min(f[j + x / 10], g[j] + x);
    for (int j = 0; j <= maxn; j += 100)
      f[j - min(j, x)] = min(f[j - min(j, x)], g[j] + max(0, x - j));
  }
  for (int i = 0; i <= maxn; i += 100) ans = min(ans, f[i]);
  printf("%d\n", ans);
}
