#include<iostream>

using namespace std;

char length(int in){
  if(in > 160) return 'Z';
  if(in > 140) return 'F';
  if(in > 120) return 'E';
  if(in > 100) return 'D';
  if(in > 80) return 'C';
  if(in > 60) return 'B';
  return 'A';
}

char weight(int in){
  if(in > 25) return 'Z';
  if(in > 20) return 'F';
  if(in > 15) return 'E';
  if(in > 10) return 'D';
  if(in > 5) return 'C';
  if(in > 2) return 'B';
  return 'A';
}

int price(char x){
  if(x == 'Z') return 0;
  if(x == 'A') return 600;
  if(x == 'B') return 800;
  if(x == 'C') return 1000;
  if(x == 'D') return 1200;
  if(x == 'E') return 1400;
  return 1600;
}
int main(){

  int n;
  while (cin >> n){
    if(n == 0) break;
    int sum = 0;
    for(int i = 0; i < n; i++){
      int x,y,h,w,len;
      cin >> x>>y>>h>>w;
      len = x+y+h;
      char judgel = length(len);
      char judgew = weight(w);
      char judge;
      if(judgel >= judgew) judge = judgel;
      else judge = judgew;

      sum += price(judge);

    }
    cout << sum << endl;
  }
  return 0;
}