#include <iostream>
using namespace std;

int main(){
   int i,n,a[3],w,total,sum;
   int big[] = {60,80,100,120,140,160,0};
   int wai[] = {2,5,10,15,20,25,0};
   int price[] = {600,800,1000,1200,1400,1600,0};
   bool judge;
   while(cin >> n,n){
      sum = 0;
      while(n--){
         cin >> a[0] >> a[1] >> a[2] >> w;
         total = a[0] + a[1] + a[2];
         for(i=0;i<6;i++,judge = false){
            if(total > big[i]) judge = true;
            if(w > wai[i]) judge = true;
            if(!judge) break;
         }
         sum += price[i];
      }
      cout << sum << endl;
   }
}