#include<iostream>
using namespace std;
int main(){
  int x ,y ,h ,w ,n ,size ,price ,total=0;
  while( true ){
    cin >> n;
    if( n == 0 ){
      break;
    }
    for( int j=0 ; j<n ; j++ ){
      cin >> x >> y >> h >> w;
      size = x + y + h;
      if( size <= 60 && w <= 2 ){
	price = 600;
      }
      
      else if( size <= 80 && w <= 5 ){
	price = 800;
      }
      
      else if( size <= 100 && w <= 10 ){
	price = 1000;
      }
      
      else if( size <= 120 && w <= 15 ){
	price = 1200;
      }
      
      else if( size <= 140 && w <= 20 ){
	price = 1400;
      }
      
      else if( size <= 160 && w <= 25 ){
	price = 1600;
      }

      else{
	price = 0;
      }

      total += price;
    }
    cout << total << endl;
    total = 0;
  }
}