#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  int S[]={60,80,100,120,140,160};
  int W[]={2,5,10,15,20,25};
  int M[]={600,800,1000,1200,1400,1600};
  while(cin >> n , n){
    int sum = 0;
    for(int i=0;i<n;i++){
      int x,y,h,w;
      cin >> x >> y >> h >> w;
      int size = x + y + h;
      if(size > 160 || w > 25) continue;
      for(int i=0;i<6;i++){
	if(size <= S[i] && w <= W[i]){
	  sum += M[i];
	  break;
	}
      }
    }
    cout << sum << endl;
  }
}