#include<iostream>
#include<vector>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	vector<int> weight,length;
	long long n;
	while(1){
		cin>>n;
		if(n==0)break;
		rep(i,n){
			int x,y,h,w;
			cin>>x>>y>>h>>w;
			length.push_back(x+y+h);
			weight.push_back(w);
		}
		long long price=0;
		rep(i,weight.size()){
			int nl=length[i],nw=weight[i];
			if(nl>160 || nw>25){}
			else if(nl>140 || nw>20) price+=1600;
			else if(nl>120 || nw>15) price+=1400;
			else if(nl>100 || nw>10) price+=1200;
			else if(nl>80 || nw>5) price+=1000;
			else if(nl>60 || nw>2) price+=800;
			else price+=600;
		}
		cout<<price<<endl;
		while(!weight.empty()){
			weight.pop_back();
			length.pop_back();
		}
	}
	return 0;
}