/*
 * 0160.cpp
 *
 *  Created on: 2011/07/29
 *      Author: isa
 */

#include <iostream>

using namespace std;

int chk(int sum, int w){
	if(sum <= 60 && w <= 2){
		return 600;
	}else if(sum <= 80 && w <= 5){
		return 800;
	}else if(sum <= 100 && w <= 10){
		return 1000;
	}else if(sum <= 120 && w <= 15){
		return 1200;
	}else if(sum <= 140 && w <= 20){
		return 1400;
	}else if(sum <= 160 && w <= 25){
		return 1600;
	}else{
		return 0;
	}
}

int main(void){
	int n,x,y,z,w;
	while(cin >> n && n){
		int ret=0;
		for(int i=0;i<n;i++){
			cin>>x>>y>>z>>w;
			ret += chk(x+y+z,w);
		}
		cout << ret << endl;
	}
}