#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
	int n;
	while(cin >> n, n){
		int ret = 0;
		for(int i=0; i < n; i++){
			int a, b, c, w;
			cin >> a >> b >> c >> w;
			int h = a + b + c;
			if(h <= 60 && w <= 2) ret += 600;
			else if(h <= 80 && w <= 5) ret += 800;
			else if(h <= 100 && w <= 10) ret += 1000;
			else if(h <= 120 && w <= 15) ret += 1200;
			else if(h <= 140 && w <= 20) ret += 1400;
			else if(h <= 160 && w <= 25) ret += 1600;
		}
		cout << ret << endl;
	}
}