#include<iostream>
#include<vector>
#include<string>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cstdio>
using namespace std;

int main(void){ 
  int n;
  int s[] = {60,80,100,120,140,160};
  int we[] = {2,5,10,15,20,25};
  int f[] = {600,800,1000,1200,1400,1600};

  while(cin>>n,n){
    int x,y,h,w;
    int sum = 0;
    while(n--){
      cin>>x>>y>>h>>w;
      int nn = x+y+h;
      bool ok1=true,ok2=true;
      int i = 0;
      if(nn >=160)continue;
      if(w >= 25)continue;
      for(i = 0 ; i < 5 ; i ++){
	//cout<<i<<" "<<f[i]<<endl;
	if(s[i] >= nn)ok1 = false;
	if(we[i] >= w)ok2 = false;
	if(!ok1&&!ok2)break;
      }
      //cout<<x<<y<<h<<w<<" "<<f[i]<<endl;
      sum+= f[i];
    }
    cout<<sum<<endl;
    //cout<<endl;
  }
}