#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007;


int p[3][7]={{160,140,120,100,80,60,0},
			{25,20,15,10,5,2,0},
			{0,1600,1400,1200,1000,800,600}
		};

int main(){
	int n,x,y,h,w;
	int b;
	int ans;
	while(cin>>n &&n>0){
		ans=0;
		rep(i,n){
			cin>>x>>y>>h>>w;
			b=x+y+h;
			rep(j,7){
				if(b>p[0][j]||w>p[1][j]){
					ans+=p[2][j];
					break;
				}
			}
		}
		cout<<ans<<endl;
	}
}