#include <iostream>

int getValue(int size, int w)
{
	int vs;
	if (size <= 60) vs = 0;
	else if (size <= 80) vs = 1;
	else if (size <= 100) vs = 2;
	else if (size <= 120) vs = 3;
	else if (size <= 140) vs = 4;
	else if (size <= 160) vs = 5;
	else vs = 6;
	int vw;
	if (w <= 2) vw =0;
	else if (w <= 5) vw = 1;
	else if (w <= 10) vw = 2;
	else if (w <= 15) vw = 3;
	else if (w <= 20) vw = 4;
	else if (w <= 25) vw = 5;
	else vw = 6;
	int v = std::max(vs, vw);
	switch (v) {
	case 0:
		return 600;
	case 1:
		return 800;
	case 2:
		return 1000;
	case 3:
		return 1200;
	case 4:
		return 1400;
	case 5:
		return 1600;
	default:
		return 0;
	}
}

int main()
{
	int n;
	while (true) {
		std::cin >> n;
		if (n==0) break;
		int res = 0;
		for (int i=0; i<n; i++) {
			int x, y, h, w;
			std::cin >> x >> y >> h >> w;
			res += getValue(x+y+h, w);
		}
		std::cout << res << std::endl;
	}
	return 0;
}

