#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int n,x,y,h,W,s[]={60,80,100,120,140,160,1000},w[]={2,5,10,15,20,25,1000},p[]={600,800,1000,1200,1400,1600,0};

int main(){
	while(cin>>n&&n){
		int ans=0;
		rep(i,n){
			cin>>x>>y>>h>>W;
			int S=x+y+h,cur=0;
			while(S>s[cur]||W>w[cur])cur++;
			ans+=p[cur];
		}
		cout<<ans<<endl;
	}
}