#include <iostream>

using namespace std;

const int MAX_N = 1000;

int main()
{
/*
A TCY	B TCY	C TCY	D TCY	E TCY	F TCY
å«³	60cmÈà	80cmÈà	100cmÈà	120cmÈà	140cmÈà	160cmÈà
d³	2kgÈà	5kgÈà	10kgÈà	15kgÈà	20kgÈà	25kgÈà
¿à	600~	800~	1000~	1200~	1400~	1600~
*/
	const int volume[] = { 0, 60, 80, 100, 120, 140, 160, MAX_N };
	const int wight[]  = { 0,  2,  5,  10,  15,  20,  25, MAX_N };
	const int fee[]    = { 0,600,800,1000,1200,1400,1600 };   
//	cut here before submit 
//	freopen ("testcase.deliveryfee", "r", stdin );
	int n;
	
	while (1){
		cin >> n;
		if (n == 0){
			break;
		} // end if
		
		int i,j,k;
		int res = 0;
		for (i = 0; i < n; ++i){
			int x, y, h, w;
			cin >> x >> y >> h >> w;
			int v = x + y + h;
			int vrange = -1, wrange = -1, range = -1;

			for (j = 1; j < 8; ++j){
				if (volume[j-1] < v && v <= volume[j] ){
					vrange = j;
					break;
				} // end if
			} // end for

			for (k = 1; k < 8; ++k){
				if (wight[k-1] < w && w <= wight[k] ){
					wrange = k;
					break;
				} // end if
			} // end for
			range = max (vrange, wrange );
			
			if (range < 7 ){
				res += fee[range];
			} // end if
		} // end for
		cout << res << endl;
	} // end loop
		
	return 0;
}