#include<iostream>
using namespace std;

int main(){
	int fee = 0;
	int x, y, h, w;
	int n;
	int size;

	while(cin >> n, n){
		fee = 0;
		for(int l=0; l < n; l++){
			cin >> x >> y >> h >> w;
			size = x + y + h;

			if(size <= 60 && w <= 2) fee += 600;
			else if(size <= 80 && w <= 5) fee += 800;
			else if(size <= 100 && w <= 10) fee += 1000;
			else if(size <= 120 && w <= 15) fee += 1200;
			else if(size <= 140 && w <= 20) fee += 1400;
			else if(size <= 160 && w <= 25) fee += 1600;
		}
		cout << fee << endl;
	}
}