#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
#include <iterator>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main()
{
	int n;
	while(scanf("%d", &n), n){
		int fee = 0;
		rep(i, n){
			int x, y, h, w;
			scanf("%d%d%d%d", &x, &y, &h, &w);
			const int length[] = {60, 80, 100, 120, 140, 160};
			const int weights[] = {2, 5, 10, 15, 20, 25};
			const int fees[] = {600, 800, 1000, 1200, 1400, 1600, 0};
			fee += fees[max(lower_bound(length, length+6, x+y+h)-length, lower_bound(weights, weights+6, w)-weights)];
		}
		printf("%d\n", fee);
	}

	return 0;
}