#include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)

int main(){
    int n;
	int size[] = {0, 60, 80, 100, 120, 140, 160};
	int weight[] = {0, 2, 5, 10, 15, 20, 25};
	int cost[] = {600, 800, 1000, 1200,	1400, 1600, 0};
	while(cin >> n, n) {
		int ret = 0;
		rep(i,n) {
			int x, w, a = 0;
			rep(j,3) {
				cin >> x;
				a += x;
			}
			cin >> w;
			for(int j = 6; j >= 0; --j) { 
				if(size[j] < a) {
					ret += cost[j];
					break;
				}
				if(weight[j] < w) {
					ret += cost[j];
					break;
				}
			}
		}
		cout << ret << endl;
	}
    return 0;
}