#include <cstdio>

int main(){
	int x, y, h, w, size, fee, sumfee;
	int n;
	
	for(;;){
                scanf("%d", &n);
		if(n == 0) break;
                sumfee = 0;
		for(int i = 0; i < n; i++){
			scanf("%d %d %d %d", &x, &y, &h, &w);
			size = x + y + h;
			fee = 0;
			if(size <= 60){
				fee = 600;
			}else if(size <= 80){
				fee = 800;
			}else if(size <= 100){
				fee = 1000;
			}else if(size <= 120){
				fee = 1200;
			}else if(size <= 140){
				fee = 1400;
			}else if(size <= 160){
				fee = 1600;
			}
		
			if(w <= 2 && fee <= 600){
				fee = 600;
			}else if(w <= 5 && fee <= 800){
				fee = 800;
			}else if(w <= 10 && fee <= 1000){
				fee = 1000;
			}else if(w <= 15 && fee <= 1200){
				fee = 1200;
			}else if(w <= 20 && fee <= 1400){
				fee = 1400;
			}else if(w <= 25 && fee <= 1600){
				fee = 1600;
			}else {
				fee = 0;
			}
		
			sumfee += fee;
		}
		printf("%d\n", sumfee);
	}
	return 0;
}