#include<stdio.h>
int main(void)
{
	int n,x[10000],y[10000],h[10000],w[10000],i,a;
	long long z;
	while(1){
		scanf("%d",&n);
		if(n==0) break;
		z=0;
		for(i=0;i<n;i++){
			scanf("%d %d %d %d",&x[i],&y[i],&h[i],&w[i]);
			a=x[i]+y[i]+h[i];
			if(w[i]<3 && a<61) z=z+600;
			else if(w[i]<6 && a<81) z=z+800;
			else if(w[i]<11 && a<101) z=z+1000;
			else if(w[i]<16 && a<121) z=z+1200;
			else if(w[i]<21 && a<141) z=z+1400;
			else if(w[i]<26 && a<161) z=z+1600;
		}
		printf("%lld\n",z);
	}
	return 0;
}