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

int main(){
  int n,i,j,x,y,h,w,s,mo;
  int c[6]={60,80,100,120,140,160};
  int b[6]={2,5,10,15,20,25};
  int m[6]={600,800,1000,1200,1400,1600};

  while(cin>>n,n!=0){
    mo=0;
    for(i=0;i<n;i++){
      cin>>x>>y>>h>>w;
      s=x+y+h;
      if(s>c[5]||w>b[5])continue;
      for(j=0;j<6;j++){
	if(s<=c[j]&&w<=b[j]){mo+=m[j];break;}
      }
    }
    cout<<mo<<endl;  
}
return 0;
}