#include<iostream>
using namespace std;

int main()
{
	int n, i, x, y, h , w, s, fee;
	while (cin>>n, n) {
		fee = 0;
		for (i = 0; i < n; i++) {
			cin>>x>>y>>h>>w;
			s = x+y+h;
			if (s<=60&&w<=2) fee += 600;
			else if (s<=80&&w<=5) fee += 800;
			else if (s<=100&&w<=10) fee += 1000;
			else if (s<=120&&w<=15) fee += 1200;
			else if (s<=140&&w<=20) fee += 1400;
			else if (s<=160&&w<=25) fee += 1600;
		}
		cout<<fee<<endl;
	}
	return 0;
}