//0160.cpp
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	vector<int>l;
	int n;
	int a, b, c, x;
	while (true){
		cin >> n;
		if (n == 0)break;
		int sum = 0;
		for (int i = 0; i < n; i++){
			cin >> a >> b >> c >> x;
			a += b;
			a += c;
			if (a <= 60 && x <= 2)
				sum += 600;
			else if (a <= 80 && x <= 5)
				sum += 800;
			else if (a <= 100 && x <= 10)
				sum += 1000;
			else if (a <= 120 && b <= 15)
				sum += 1200;
			else if (a <= 140 && b <= 20)
				sum += 1400;
			else if (a <= 160 && b <= 25)
				sum += 1600;
		}
		l.push_back(sum);
	}
	for (int i : l) {
		cout << i << endl;
	}
	cin >> c;
}