#include <iostream>
using namespace std;

int main() {

  int n;
  int x,y,h,w;
  int r1[6] = {60,80,100,120,140,160};
  int r2[6] = {2,5,10,15,20,25};
  int r3[6] = {600,800,1000,1200,1400,1600};
  
  while(1){  
    cin >> n;
    if(n == 0) break;
    int sum = 0;
    
    for(int i=0;i<n;i++) {     

      cin >> x >> y >> h >> w;
      int size = x + y + h;
      
      for(int j=0;j<6;j++) {
	if(size <= r1[j] && w <= r2[j]){
	  sum += r3[j];
	  break;
	}
      }
     
    }

    cout << sum << endl;

  }

  return 0;

}
	  

      