#include<iostream>
using namespace std;

int judge(int size, int w){
	if(size <= 120 && w <= 15){
		if(size <= 80 && w <= 5){
			if(size <= 60 && w <= 2) return 600;
			else return 800;
		} else if(size <= 100 && w <= 10) return 1000;
		else return 1200;
	} else if(size <= 160 && w <= 25){
		if(size <= 140 && w <= 20) return 1400;
		else return 1600;
	} else return 0;
}

int main(){
	int n, x, y, h, w, charge, sum;
	while(1){
		cin >>n;
		if(n == 0) break;
		
		sum = 0;
		for(int i = 0; i < n; i++){
			cin >>x >>y >>h >>w;
			sum += judge((x + y + h), w);
		}
		cout <<sum <<endl;
	}
	return 0;
}