#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
int a[7]={160,140,120,100,80,60,0};
int b[7]={25,20,15,10,5,2,0};
int c[7]={0,1600,1400,1200,1000,800,600};
int n;
while(cin>>n,n){
int sum=0;
rep(i,n){
int x,y,h,w;
cin>>x>>y>>h>>w;
rep(j,7)if(x+y+h>a[j]||w>b[j]){sum+=c[j];break;}
}
cout<<sum<<endl;
}
}