// #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
//#define foreach_it(type,it,c) for(type::iterator it=c.begin(); it!=c.end(); ++it)
// fast?
#define foreach_it(type,it,c) for(type::iterator it=c.begin(), c_end=c.end(); it!=c_end; ++it)

int Yen(int x, int y, int h, int w){
	int ret = 0;
	int inSize = x + y + h;
	int inWeight = w;
	// C++11
	vector<pair<int, int> > size_weight_List
	{MP(60,2),MP(80,5),MP(100,10),MP(120,15),MP(140,20),MP(160,25)};
	VI feeList{ 600, 800, 1000, 1200, 1400, 1600 };

	FOR(i, 0, size_weight_List.size()){
		if (inSize <= size_weight_List[i].first && inWeight <= size_weight_List[i].second){
			ret = feeList[i];
			break;
		}
	}
	return ret;
}

int main(){
	int n;
	int x, y, h, w;
	long long ans = 0;
	fastIO;
	
	while (cin >> n){
		while (n--){
			cin >> x >> y >> h >> w;
			ans += Yen(x, y, h, w);
		}
		cout << ans << endl;
		ans = 0;
	}
	return 0;
}