#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,x,y,h,w,a;
	int cost[6]={600,800,1000,1200,1400,1600};
	int weight[8]={0,2,5,10,15,20,25,10000};
	int size[8]={0,60,80,100,120,140,160,10000};
	while(cin>>n,n){
		int ans=0;
		while(n--){
			int data=-1;
			cin>>x>>y>>h>>w;
			a=max(x,max(y,h));
			if(w>25||a>160)continue;
			for(int i=1;i<8;i++){
				if(size[i-1]<a&&a<=size[i])data=max(data,i-1);
				if(weight[i-1]<w&&w<=weight[i])data=max(data,i-1);
			}
			ans+=cost[data];
		}
		cout<<ans<<endl;
	}
}