#include <bits/stdc++.h>

using namespace std;

const int BaseMoney = 600;

int judge(const int sumLength, int w) {
	int index;

	if (w <= 2 && sumLength <= 60) {
		index = 0;
	}
	else if (w <= 5 && sumLength <= 80) {
		index = 1;
	}
	else if (w <= 10 && sumLength <= 100) {
		index = 2;
	}
	else if (w <= 15 && sumLength <= 120) {
		index = 3;
	}
	else if (w <= 20 && sumLength <= 140) {
		index = 4;
	}
	else if (w <= 25 && sumLength <= 160) {
		index = 5;
	}
	else {
		return 0;
	}

	return BaseMoney + 200 * index;
}

int main(void) {
	int n, x, y, h, w, sumLength, sum;

	while (cin >> n, n) {
		sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> x >> y >> h >> w;

			sumLength = x + y + h;
			sum += judge(sumLength, w);
		}
		cout << sum << endl;
	}

	return 0;
}
