#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main() {
	while (true) {
		int n, ans = 0;
		cin >> n;
		if (n == 0) break;

		REP(i, n) {
			int x, y, h, w;
			scanf("%d %d %d %d", &x, &y, &h, &w);

			int s = x + y + h;
			int size1 = ceil((s - 60) / 20.0);
			if (size1 > 5) continue;
			if (size1 < 0) size1 = 0;

			int dw[] = {2, 5, 10, 15, 20, 25};
			int size2 = 0;
			REP(i, 6) if (w > dw[i]) size2++;
			if (size2 > 5) continue;

			ans += 600 + 200*max(size1, size2);
		}
		cout << ans << endl;
	}
	return 0;
}