#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int n;
	cin >> n;
	if(n == 0) break;
	int ans = 0;
	int m;
	REP(i,n){
	    int x,y,h,w;
	    cin >> x >> y >> h >> w;
	    int s = x + y + h;
	    m = 0;
	    if( s > 160) continue;
	    else if(s > 140)  m = 1400;
	    else if(s > 120) m = 1200;
	    else if(s > 100) m = 1000;
	    else if(s > 80) m = 800;
	    else m = 600;

	    if(w > 25) continue;
	    else if(w > 20) m = max(m,1600);
	    else if(w > 15) m = max(m,1400);
	    else if(w > 10) m = max(m,1200);
	    else if(w > 5)  m = max(m,1000);
	    else if(w > 2)  m = max(m,800);
	    else m = max(m,600);
	    ans += m;
	}
	cout << ans << endl;
    }
    return 0;
}