#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	vector<int>hs{ 60,80,100,120,140,160 };
	vector<int>ws{ 2,5,10,15,20,25 };
	vector<int>ms{ 600,800,1000,1200,1400,1600 };
	while (1) {
		int N; cin >> N;
		if (!N)break;
		int ans = 0;
		for (int i = 0; i < N; ++i) {
			int x, y, h, w; cin >> x >> y >> h >> w;
			int l = x + y + h;
			auto it = lower_bound(hs.begin(), hs.end(), l);
			auto jt = lower_bound(ws.begin(), ws.end(),w);
			int num = max(it - hs.begin(), jt - ws.begin());
			if (num == 6)continue;
			else ans += *(ms.begin() + num);
		}
		cout << ans << endl;
	}
	
	return 0;
}