#include<cstdio>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n),n){
        int sum=0;
        while(n--){
            int s=0,h;
            for(int i=0;i<3;i++){
                int l;
                scanf("%d",&l);
                s+=l;
            }
            scanf("%d",&h);
            if(s<=60&&h<=2)sum+=600;
            else if(s<=80&&h<=5)sum+=800;
            else if(s<=100&&h<=10)sum+=1000;
            else if(s<=120&&h<=15)sum+=1200;
            else if(s<=140&&h<=20)sum+=1400;
            else if(s<=160&&h<=25)sum+=1600;
        }
        printf("%d\n",sum);
    }
    return 0;
}