#include <iostream>
using namespace std;

int main(){
	int n,sum,kg,x,y,z;
	while(cin >> n && n){
		sum = 0;
		for(int i=0;i<n;i++){
			cin >> x >> y >> z >> kg;
			x=x+y+z;
			sum += (x>160||kg>25)?0:
				(x>140||kg>20)?1600:
				(x>120||kg>15)?1400:
				(x>100||kg>10)?1200:
				(x>80||kg>5)?1000:
				(x>60||kg>2)?800:
				600;
		}
		cout << sum << endl;
	}
}