#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;
const int MAX = 10000;

/** Problem0160 : Delivery Fee **/
int main()
{
	int size[6] = {60, 80, 100, 120, 140, 160};
	int weight[6] = {2, 5, 10, 15, 20, 25};
	int fee[6] = {600, 800, 1000, 1200, 1400, 1600};
	
	int n;
	
	while (cin>>n, n!=0) {
		int a, b, c, d, sum=0;
		rep(k, n) {
			cin >> a >> b >> c >> d;
			rep(i, 6) {
				if (d <= weight[i] && a+b+c <= size[i]) {
					sum+=fee[i];
					break;
				}
			}
		}
		cout << sum << endl;
	}
}