#include<iostream>

using namespace std;

int main()
{
	int n,i,j;
	
	for(;;)
	{
		cin >> n;
		if(n==0)
			break;
		
		int ans=0;
		
		for(i=0;i<n;i++)
		{
			int size=0,weight;
			for(j=0;j<3;j++)
			{
				int a;
				cin >> a;
				size+=a;
			}
			cin >> weight;
			if(size<=160 && weight<=25)
			{
				if(size>140 || weight>20)
				{
					ans+=1600;
				}
				else if(size>120 || weight>15)
				{
					ans+=1400;
				}
				else if(size>100 || weight>10)
				{
					ans+=1200;
				}
				else if(size>80 || weight>5)
				{
					ans+=1000;
				}
				else if(size>60 || weight>2)
				{
					ans+=800;
				}
				else
				{
					ans+=600;
				}
			}
		}
		cout << ans << endl;
	}
}