#include<iostream>
using namespace std;
int x, y, h, w, n, sum, z;
int a[7] = { 60,80,100,120,140,160,1000000000 };
int b[7] = { 2,5,10,15,20,25,1000000000 };
int c[7] = { 600,800,1000,1200,1400,1600,0 };
int main() {
	while (true) {
		cin >> n;
		if (n == 0) { break; }
		sum = 0;
		for (int i = 0; i < n; i++){
			cin >> x >> y >> h >> w;
			z = x + y + h;
			for (int j = 0; j < 7; j++) {
				if (z <= a[j] && w <= b[j]) { sum += c[j]; break; }
			}
		}
		cout << sum << endl;
	}
}