#include <iostream>
using namespace std;

class Box {
public:
  int x, y, h, w;
  int cost() {
    int sum = x + y + h;
    if(sum <= 60 && w <= 2) return 600;
    if(sum <= 80 && w <= 5) return 800;
    if(sum <= 100 && w <= 10) return 1000;
    if(sum <= 120 && w <= 15) return 1200;
    if(sum <= 140 && w <= 20) return 1400;
    if(sum <= 160 && w <= 25) return 1600;
    return 0;
  }
};

int main() {
  while(1) {
    int n;
    cin >> n;
    if(n == 0) break;
    Box b[n];
    int sum = 0;
    for(int i = 0; i < n; i++) {
      cin >> b[i].x >> b[i].y >> b[i].h >> b[i].w;
      sum += b[i].cost();
    }
    cout << sum << endl;
  }
  return 0;
}