#include<iostream>
#include<algorithm>
using namespace std;

int main() {
	int charge[7] = {600,800,1000,1200
	,1400,1600,0 };

	int n;
	int a, b, c, d;
	while (cin >> n, n) {
		int sum = 0;

		for (int i = 0; i < n; i++) {
			int flga, flgb;
			cin >> a >> b >> c >> d;
			int e = a + b + c;

			if (e <= 60) { flga = 0; }
			else if (e <= 80) { flga = 1; }
			else if (e <= 100) { flga = 2; }
			else if (e <= 120) { flga = 3; }
			else if (e <= 140) { flga = 4; }
			else if (e <= 160) { flga = 5; }
			else { flga = 6; }

			if (d <= 2) { flgb = 0; }
			else if (d <= 5) { flgb = 1; }
			else if (d <= 10) { flgb = 2; }
			else if (d <= 15) { flgb = 3; }
			else if (d <= 20) { flgb = 4; }
			else if (d <= 25) { flgb = 5; }
			else { flgb = 6; }
			
			int flgc = max(flga, flgb);
			sum += charge[flgc];
		}
		cout << sum << endl;
	}
	return 0;
}