#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<stack>
#include<queue>

using namespace std;

int main(){
	int x,y,h,w;
	int size;
	int fee[6]={600,800,1000,1200,1400,1600};
	int n;
	while(scanf("%d",&n)){
		if(n==0) break;
		int sum=0,fl=0;
		for(int i=0;i<n;i++){
			scanf("%d %d %d %d",&x,&y,&h,&w);
			size=x+y+h;
			if(size<=60&&w<=2) sum+=fee[0];
			else if(size<=80&&w<=5) sum+=fee[1];
			else if(size<=100&&w<=10) sum+=fee[2];
			else if(size<=120&&w<=15) sum+=fee[3];
			else if(size<=140&&w<=20) sum+=fee[4];
			else if(size<=160&&w<=25) sum+=fee[5];
		}
		printf("%d\n",sum);
	}
}
