#include <iostream>

using namespace std;
int price[6] = {600, 800, 1000, 1200, 1400, 1600};

void solve()
{
	int n;
	while(cin >> n, n)
	{
		int x, y, h, w;
		int pos1 = 0;
		int pos2 = 0;
		int sum = 0;
		while(n--)
		{
			cin >> x >> y >> h >> w;
			int size = x + y + h;
			if(size <= 60)
			{
				pos1 = 0;
			}
			else if(size <= 80)
			{
				pos1 = 1;
			}
			else if(size <= 100)
			{
				pos1 = 2;
			}
			else if(size <= 120)
			{
				pos1 = 3;
			}
			else if(size <= 140)
			{
				pos1 = 4;
			}
			else if(size <= 160)
			{
				pos1 = 5;
			}
			else
			{
				pos1 = 6;
			}

			if(w <= 2)
			{
				pos2 = 0;
			}
			else if(w <= 5)
			{
				pos2 = 1;
			}
			else if(w <= 10)
			{
				pos2 = 2;
			}
			else if(w <= 15)
			{
				pos2 = 3;
			}
			else if(w <= 20)
			{
				pos2 = 4;
			}
			else if(w <= 25)
			{
				pos2 = 5;
			}
			else
			{
				pos2 = 6;
			}
			if(pos1 < pos2)
			{
				swap(pos1, pos2);
			}
			if(pos1 == 6)
			{
				continue;
			}
			sum += price[pos1];
		}
		cout << sum << endl;
	}
}

int main()
{
	solve();
	return(0);
}