#include <iostream>

using namespace std;

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

int main(int argc, char **argv)
{
	long long int w, x, y, z, n, sum;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		sum = 0;
		for(int i = 0; i < n; i++){
			cin >> x >> y >> z >> w;
			
			x = (x > y && x > z)? x : ((y > x && y > z)? y : z);
			if(w > 25 || x > 160){
				continue;
			}
			
			y = z = 0;
			for(int i = 0; i < 6; i++){
				if(x <= sc[i]){
					y = i;
					break;
				}
			}
			
			for(int i = 0; i < 6; i++){
				if(w <= we[i]){
					z = i;
					break;
				}
			}
			
			sum += cost[((y < z)? z : y)];
		}
		cout << sum << endl;
	}
	
	return 0;
}