#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	const int length[] = { 60, 80, 100, 120, 140, 160, 100000000 };
	const int weight[] = { 2, 5, 10, 15, 20, 25, 100000000 };
	const int cost[] = { 600, 800, 1000, 1200, 1400, 1600, 0 };

	while( cin >> n && n ){
		int result = 0;
		for( int i = 0; i < n; ++i ){
			int x, y, h, w;
			cin >> x >> y >> h >> w;
			int l = x + y + h;
			int gl = 0, gw = 0;
			while( l > length[ gl ] ){
				++gl;
			}
			while( w > weight[ gw ] ){
				++gw;
			}
			result += cost[ max( gl, gw ) ];
		}
		cout << result << endl;
	}

	return 0;
}