#include<stdio.h>

int main(){

int n;

while(1){

scanf("%d",&n);if(n==0)break;

int x,y,h,w;
int S=0;
for(int i=0;i<n;i++)
{
scanf("%d %d %d %d",&x,&y,&h,&w);
int s=x+y+h;
int T1=0,T2=0;

if(s<=60)T1=1;
else if(s<=80)T1=2;
else if(s<=100)T1=3;
else if(s<=120)T1=4;
else if(s<=140)T1=5;
else if(s<=160)T1=6;
else if(s>160)T1=10;

if(w<=2)T2=1;
else if(w<=5)T2=2;
else if(w<=10)T2=3;
else if(w<=15)T2=4;
else if(w<=20)T2=5;
else if(w<=25)T2=6;
else if(w>25)T2=10;


if(T1<T2)T1=T2;

int p=0;
switch(T1){
case:1
p=600;break;

case:2
p=800;break;

case:3
p=1000;break;

case:4
p=1200;break;
case:5
p=1400;break;
case:6
p=1600;break;
case:10
p=0;break;
}
S+=p;
}
printf("%d\n",S);

}
return 0;
}