#include <iostream>

using namespace std;

int cost[6] = {600, 800, 1000, 1200, 1400, 1600};

int main(int argc, char **argv)
{
	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;
			}
			
			if(x <= 60){
				y = 0;
			} else {
				if(x%20 == 0){
					x--;
				}
				y = (int)(x/20) - 2;
			}
			
			if(w <= 2){
				z = 0;
			} else {
				if(w%5 == 0){
					w--;
				}
				z = (int)(w/5)+1;
			}
			sum += cost[((y < z)? z : y)];
		}
		cout << sum << endl;
	}
	
	return 0;
}