#include <iostream>
#include <algorithm>
using namespace std;

int main() {
  int n, x, y, h, w, l, as, bs, s, cost;
  int a[6] = {60, 80, 100, 120, 140, 160};
  int b[6] = {2, 5, 10, 15, 20, 25};
  int c[6] = {600, 800, 1000, 1200, 1400, 1600};
  while (1) {
    cin >> n;
    if (!n) break;
    cost = 0;
    for (int i=0; i<n; i++) {
      cin >> x >> y >> h >> w;
      l = x + y + h;
      as = lower_bound(a, a+6, l) - a;
      bs = lower_bound(b, b+6, w) - b;
      s = max(as, bs);
      if (s < 6) {
        cost += c[s];
      }
    }
    cout << cost << endl;
  }
  return 0;
}