#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  int a[6][3]={{60,2,600},{80,5,800},{100,10,1000},
               {120,15,1200},{140,20,1400},{160,25,1600}};
  while(1){
    cin>>n;
    if(n==0)break;
    int sum=0;
    rep(i,n){
      int x,y,h,w;
      cin>>x>>y>>h>>w;
      rep(j,6)
        if(x+y+h<=a[j][0] && w<=a[j][1]){
          sum+=a[j][2];
          break;
        }
    }
    cout<<sum<<endl;
  }
}