#include<iostream>

using namespace std;

int ryou[3][6]={{60,80,100,120,140,160},
				{2,5,10,15,20,25},
				{600,800,1000,1200,1400,1600}};

int main(void){
	int n,sumPrice;
	int x,y,h,w,length;
	while(cin>>n,n){
		sumPrice=0;
		for(int i=0;i<n;i++){
			cin>>x>>y>>h>>w;
			length=x+y+h;
			for(int j=0;j<6;j++){
				if(length<=ryou[0][j] && w<=ryou[1][j]){
					sumPrice=sumPrice+ryou[2][j];
					break;
				}
			}
		}
		cout<<sumPrice<<endl;
	}
}