#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

int main(){
  int i,j,n,a[3][6];
  a[0][0] = 60;
  a[1][0] = 0;
  a[2][0] = 600;
  for(i=1;i<6;i++){
    a[0][i] = a[0][i-1] + 20;
    a[1][i] = a[1][i-1] + 5;
    a[2][i] = a[2][i-1] + 200;
  }
  a[1][0] = 2;

  while(1){
    cin >> n;
    if(n == 0) break;
    int x,y,h,w,sum=0;
    for(int t=0;t<n;t++){
      cin >> x >> y >> h >> w;
      for(i=0;i<6;i++){
	if(x + y + h <= a[0][i] && w <= a[1][i]){
	  sum += a[2][i];
	  break;
	}
      }
    }
    cout << sum << endl;
  }
  return 0;
}