#include<iostream>
using namespace std;
int main(){
  int x,y,h,w,n,size,money=0;
  while(1){
    cin >> n;
    if(n==0){
      break;
    }
    money=0;
    for(int i=0;i<n;i++){
      cin >> x >> y >> h >> w;
      size=x+y+h;

      if(size<=60 && w<=2){
	money+=600;
      }
      else if(size<=80 && w<=5){
	money+=800;
      }
      else if(size<=100 && w<=10){
	money+=1000;
      }
      else if(size<=120 && w<=15){
	money+=1200;
      }
      else if(size<=140 && w<=20){
	money+=1400;
      }
      else if(size<=160 && w<=25){
	money+=1600;
      }
    }
    cout << money << endl;
  }
  return (0);
}