#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
int a[N];
int f[45];
int g[45];
int n;
int ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), a[i] /= 100;
  memset(f, 127 / 3, sizeof(f));
  f[0] = 0;
  for (int i = 1; i <= n; i++) {
    memset(g, 127 / 3, sizeof(g));
    for (int j = 1; j <= a[i]; j++) g[0] = min(f[j] + a[i] - j, g[0]);
    for (int j = a[i] + 1; j <= 40; j++) g[j - a[i]] = min(g[j - a[i]], f[j]);
    if (a[i] == 10)
      for (int j = 1; j <= 40; j++) g[j] = min(g[j], f[j - 1] + 10);
    if (a[i] == 20)
      for (int j = 2; j <= 40; j++) g[j] = min(g[j], f[j - 2] + 20);
    memcpy(f, g, sizeof(g));
  }
  ans = 1e9;
  for (int i = 0; i <= 40; i++) ans = min(ans, f[i]);
  printf("%d", ans * 100);
  return 0;
}
