#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int main(){

	int n,sum,a,b,c,size,w;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		sum = 0;

		for(int i = 0; i < n; i++){
			scanf("%d %d %d %d",&a,&b,&c,&w);

			size = a+b+c;

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

		printf("%d\n",sum);
	}

    return 0;
}