#include<iostream>
using namespace std;

//比較用2次元配列
int wh_hako[6][2] = {{60 , 2},
					{80 , 5},
					{100 , 10},
					{120 , 15},
					{140 , 20},
					{160 , 25},};
//料金配列
int h_ryoukin[6] = {600 , 800 , 1000 , 1200 , 1400 , 1600};

typedef struct struct_data
{
	int tate;
	int yoko;
	int takasa;
	int omosa;
}S_data;

int main(void)
{
	int n = 0;
	//入力構造体
	S_data s_data = {0};

	while (1)
	{
		cin >> n;
		
		//合計金額
		int kane = 0;

		if (n == 0){	return 0;	}

		for (int i = 0; i < n; i++)
		{
			cin >> s_data.tate >> s_data.yoko >> s_data.takasa >> s_data.omosa;
			//長さの合計
			int length = s_data.tate + s_data.yoko + s_data.takasa;
			for (int j = 0; j < 6; j++)
			{
				//0が長さで1が重さ
				if (wh_hako[j][0] >= length && wh_hako[j][1] >= s_data.omosa)
				{
					kane += h_ryoukin[j];
					break;
				}
			}
		}

		cout << kane << endl;
	}
	return 0;
}