#include <iostream>
using namespace std;
int main(void){
    // Your code here!
#define MAX 10100
    int n; //荷物の個数
    int x[MAX], y[MAX], h[MAX], w[MAX]; //荷物の縦の長さ、横の長さ、高さ、重量

    while(true){
        cin >> n;
        if(n == 0) break;
        
        int l[MAX]; //荷物の大きさ
        for(int i = 0; i < n; i++){
            cin >> x[i] >> y[i] >> h[i] >> w[i];
            l[i] = x[i] + y[i] + h[i];
        }
        
        int sum = 0; //荷物の料金の総計
        for(int i = 0; i < n; i++){
            if(l[i] <= 60){
                if(w[i] <= 2) sum += 600;
                else if(w[i] <= 5) sum += 800;
                else if(w[i] <= 10) sum += 1000;
                else if(w[i] <= 15) sum += 1200;
                else if(w[i] <= 20) sum += 1400;
                else if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else if(60 < l[i] && l[i] <= 80){
                if(w[i] <= 5) sum += 800;
                else if(w[i] <= 10) sum += 1000;
                else if(w[i] <= 15) sum += 1200;
                else if(w[i] <= 20) sum += 1400;
                else if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else if(80 < l[i] && l[i] <= 100){
                if(w[i] <= 10) sum += 1000;
                else if(w[i] <= 15) sum += 1200;
                else if(w[i] <= 20) sum += 1400;
                else if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else if(100 < l[i] && l[i] <= 120){
                if(w[i] <= 15) sum += 1200;
                else if(w[i] <= 20) sum += 1400;
                else if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else if(120 < l[i] && l[i] <= 140){
                if(w[i] <= 20) sum += 1400;
                else if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else if(140 < l[i] && l[i] <= 160){
                if(w[i] <= 25) sum += 1600;
                else sum += 0;
            }
            else sum += 0;
        }
        cout << sum << endl;
    }
}

