#include<iostream>

using namespace std;

int main(){
	 
	int n;
	
	while( cin >> n ) {
		
	if( n == 0)
	break;
		
	int x, y, h, z; 
	int sum = 0;
		
	while(n--) {
		
		cin >> x >> y >> h >> z;
		
		int xyh = x + y + h;
		
		if( xyh <= 60 && z <= 2)
		sum += 600;
		
		else if( xyh <= 80 && z <= 5)
		sum += 800;
		
		else if( xyh <= 100 && z <= 10)
		sum += 1000;
		
		else if( xyh <= 120 && z <= 15)
		sum += 1200;
		
		else if( xyh <= 140 && z <= 20)
		sum += 1400;
		
		else if( xyh <= 160 && z <= 25)
		sum += 1600;
	}
	
	cout << sum << "\n";
}
  	return 0;
}
