#include<iostream>
#include<algorithm>

#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)

using namespace std;

int main(){
	int x[3],w;
	int n;
	while(cin>>n,n){
		int sum=0;
		rep(i,n){
			rep(j,3)cin>>x[j];
			cin>>w;
			sort(x,x+3);
			int size=x[0]+x[1]+x[2];
			if(size<=60&&w<=2)sum+=600;
			else if(size<=80&&w<=5)sum+=800;
			else if(size<=100&&w<=10)sum+=1000;
			else if(size<=120&&w<=15)sum+=1200;
			else if(size<=140&&w<=20)sum+=1400;
			else if(size<=160&&w<=25)sum+=1600;
//			cout<<size<<" "<<w<<" "<<sum<<endl;
		}
		cout<<sum<<endl;
	}
	
}