#include <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0) break;
		const int SIZ[]={60,80,100,120,140,160};
		const int W[]={2,5,10,15,20,25};
		const int FEE[]={600,800,1000,1200,1400,1600,0};
		int x,y,h,w,sum=0;
		for(int i=0;i<n;++i){
			cin>>x>>y>>h>>w;
			int j,size = max(h,max(x,y));
			for(j=0;j<6;++j)if(size<=SIZ[j]&&w<=W[j]) break;
			sum+=FEE[j];
		}
		cout<<sum<<"\n";
	}
	return 0;
}