#include <iostream>
using namespace std;

int size[6] = {60, 80, 100, 120, 140, 160};
int weight[6] = {2, 5, 10, 15, 20, 25};
int fee[7] = {600, 800, 1000, 1200, 1400, 1600, 0};

int main() {
	int n;
	int x, y, h, w;
	int cost;
	
	while(cin >> n, n){
		cost = 0;
		
		for(int i = 0; i < n; ++i){
			cin >> x >> y >> h >> w;
			int k, l;
			
			for(k = 0; k < 6; ++k){
				if(x + y + h <= size[k]) break;
			}
			
			for(l = 0; l < 6; ++l){
				if(w <= weight[l]) break;
			}
			
			cost += fee[max(k, l)];
		}
		cout << cost << endl;
	}
	
	return 0;
}