#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	char s[6] = { 'A','B','C','D','E','F' };
	int big[6] = { 60,80,100,120,140,160 };
	int h[6] = { 2,5,10,15,20,25 };
	int m[6] = { 600,800,1000,1200,1400,1600 };
	int n;
	while (cin >> n&&n != 0) {
		int sum = 0;
		for (int z = 0; z < n; z++) {
			int k, l, o, p,q=-1,r=-1;
			cin >> k >> l >> o >> p;
			k += (l + o);
			for (int i = 0; i < 6; i++) {
				if (k <= big[i]) {
					q = m[i];
					break;
				}
			}
			for (int i = 0; i < 6; i++) {
				if (p <= h[i]) {
					r = m[i];
					break;
				}
			}
			if (q != -1 && r != -1) {
				sum += max(q, r);
			}
		}
		cout << sum << endl;
	}
}