#include <iostream>
using namespace std;

int price(int s,int w) {
  int sizeprice,wprice;
  if(s <=60) {
    sizeprice = 0;
  }
  else if(s <= 80) {
    sizeprice = 1;
  }
  else if(s <= 100) {
    sizeprice = 2;
  }
  else if(s <= 120) {
    sizeprice = 3;
  }
  else if(s <= 140) {
    sizeprice = 4;
  }
  else if(s <= 160) {
    sizeprice = 5;
  }
  else {
    sizeprice = 6;
  }
  if(w <=2) {
    wprice = 0;
  }
  else if(w <= 5) {
    wprice = 1;
  }
  else if(w <= 10) {
    wprice = 2;
  }
  else if(w <= 15) {
    wprice = 3;
  }
  else if(w <= 20) {
    wprice = 4;
  }
  else if(w <= 25) {
    wprice = 5;
  }
  else {
    wprice = 6;
  }
  if(max(sizeprice,wprice)<6) {
    return max(sizeprice,wprice) * 200 +600;
    }
  else {
    return 0;
  }
}

int main() {
  int n,x,y,h,w,size,sum=0;
  while(cin >> n) {
    if(n==0) break;
    for(int i=0;i<n;i++) {
      cin >> x >> y >> h >> w;
      size = x+y+h;
      sum += price(size,w);
    }
    cout << sum << endl;
    sum=0;
  }
}