#include<iostream>
#include<cstdlib>
#include<algorithm>
using namespace std;
int main(){
  int n,a[3],b,cnt,j;
  int sum;
  int tmpr[]={600,800,1000,1200,1400,1600,0};
  int tmpb[]={60,80,100,120,140,160,0};
  int tmpw[]={2,5,10,15,20,25,0};
  while(1){
    cin >> n;
    if(n==0)break;
    cnt=0;
    for(int i=0;i<n;i++){
      cin >> a[0] >> a[1] >> a[2] >> b;
      j=0;
      for(int flg=0;j<6;j++,flg=0){
	for(int k=0;k<3;k++){
	  if(tmpb[j]<a[k]){
	    flg=1;
	  }
	}
	if(tmpw[j]<b) flg=1;

	if(flg==0) break;
      }
      cnt += tmpr[j];
    }
    cout << cnt << endl;
  }
}