#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5, mod = 1e9 + 7;
int koszt[31], tmp[31];
int main() {
  int a, b, c, d, e, f, g, z, k, n, m, q;
  scanf("%d", &n);
  for (a = 1; a <= 30; a++) koszt[a] = 1000000000;
  while (n--) {
    scanf("%d", &a);
    if (a == 1000) {
      for (b = 0; b <= 30; b++) tmp[b] = 1000000000;
      for (b = 1; b <= 30; b++) tmp[b] = koszt[b - 1] + 1000;
      for (b = 0; b <= 30; b++)
        for (c = b + 1; c <= 30 && c - b <= 10; c++)
          tmp[b] = min(tmp[b], koszt[c] + 1000 - (c - b) * 100);
    } else {
      for (b = 0; b <= 30; b++) tmp[b] = 1000000000;
      for (b = 2; b <= 30; b++) tmp[b] = koszt[b - 2] + 2000;
      for (b = 0; b <= 30; b++)
        for (c = b + 1; c <= 30 && c - b <= 20; c++)
          tmp[b] = min(tmp[b], koszt[c] + 2000 - (c - b) * 100);
    }
    for (b = 0; b <= 30; b++) koszt[b] = tmp[b];
  }
  b = koszt[0];
  for (a = 1; a <= 30; a++) b = min(b, koszt[a]);
  printf("%d", b);
  return 0;
}
