#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,x,y,h,w,size,sum;
    sum=0;
    while (cin>>n) {
        if (n==0) {
            break;
        } else {
            for (int i=0;i<n;i++) {
                cin>>x>>y>>h;
                size=x+y+h;
                cin>>w;
                if (size<=60 && w<=2) {
                    sum=sum+600;
                } else if (size<=80 && w<=5) {
                    sum=sum+800;
                } else if (size<=100 && w<=10) {
                    sum=sum+1000;
                } else if (size<=120 && w<=15) {
                    sum=sum+1200;
                } else if (size<=140 && w<=20) {
                    sum=sum+1400;
                } else if (size<=160 && w<=25) {
                    sum=sum+1600;
                }
            }
            cout<<sum<<endl;
            sum=0;
        }
    }
}

