#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b,c,w;
	while(cin>>n,n){
		long int p=0;
		while(n--){
		cin>>a>>b>>c>>w;
		int s=a+b+c;
		if(s<=60&&w<=2)p+=600;
		else if(s<=80&&w<=5)p+=800;
		else if(s<=120&&w<=15)p+=1200;
		else if(s<=140&&w<=20)p+=1400;
		else if(s<=160&&w<=25)p+=1600;else;
	    }
	    cout<<p<<endl;
	}
	return 0;
}