#include <iostream>
using namespace std;

int length[6] = {60,80,100,120,140,160};
int weight[6] = {2,5,10,15,20,25};
int fee[6] = {600,800,1000,1200,1400,1600};

int main(int argc, const char * argv[]) {
    
    while (true) {
        int n;
        cin >> n;
        if(n == 0){
            break;
        }
        
        int sum = 0;
        for(int i=0;i<n;i++){
            int x,y,h,w;
            cin >> x >> y >> h >> w;
            
            for(int j=0;j<6;j++){
                if(length[j] >= x+y+h && weight[j] >= w){
                    sum+= fee[j];
                    break;
                }
            }
            
        }
        
        cout << sum << endl;
    }
    
    return 0;
}