#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    int n;
    while(cin >> n, n){
        int ans = 0;
        rep(i,n){
            int x, y, h, w;
            int size = 100, hevy = 100;
            cin >> x >> y >> h >> w;
            rep(i,6){
                int cm = 60 + 20 * i;
                if(x + y + h <= cm){
                    size = i;
                    break;
                }
            }
            rep(i,6){
                if(w <= 2){
                    hevy = 0;
                    break;
                }else if(w <= i * 5){
                    hevy = i;
                    break;
                }
            }
            int money = max(size, hevy) ;
            rep(i,6){
                if(money == 100) break;
                if(money == i){
                    ans+= 600 + 200 * i;
                    break;
                }
            }
        }
        cout << ans << endl;
    }
}