#include <bits/stdc++.h>
using namespace std;
const int MAX = 1 << 29;
int main() {
  int n, dpa[300], dpb[300], t, ans = MAX;
  scanf("%d", &n);
  dpa[0] = 0;
  for (int i = 1; i < 300; i++) dpa[i] = MAX;
  while (n--) {
    scanf("%d", &t);
    for (int i = 0; i < 300; i++) dpb[i] = MAX;
    if (t == 1000) {
      for (int i = 0; i <= 30; i++)
        for (int j = i + 1; j <= 30 && j <= i + 10; j++)
          dpb[i] = min(dpb[i], dpa[j] + (10 - j + i));
      for (int i = 1; i <= 30; i++) dpb[i] = min(dpb[i], dpa[i - 1] + 10);
    } else {
      for (int i = 0; i <= 30; i++)
        for (int j = i + 1; j <= 30 && j <= i + 20; j++)
          dpb[i] = min(dpb[i], dpa[j] + (20 - j + i));
      for (int i = 2; i <= 30; i++) dpb[i] = min(dpb[i], dpa[i - 2] + 20);
    }
    memcpy(dpa, dpb, sizeof(dpa));
  }
  for (int i = 0; i <= 30; i++) ans = min(ans, dpa[i]);
  printf("%d00\n", ans);
  return 0;
}
