#include <iostream>
#include <cstdio>
using namespace std;
int main(){
  int a,b,c,d;
  int n;
  while(cin >> n,n){
    int sum = 0;
    for(int i = 0 ; i < n ; i++ ){
      cin >> a >> b >> c >> d;
      int m = a+b+c;
      if(m <= 60 && d <= 2){
	sum += 600;
      }else if(m <= 80 && d <= 5){
	sum += 800;
      }else if(m <= 100 && d <= 10){
	sum += 1000;
      }else if(m <= 120 && d <= 15){
	sum += 1200;
      }else if(m <= 140 && d <= 20){
	sum += 1400;
      }else if(m <= 160 && d <= 25){
	sum += 1600;
      }
    }
    cout << sum << endl;
  }
}