#include <iostream>
#include <vector>
#include <cstring>
#include <cmath>
using namespace std;

int n;
int fee[] = {600, 800, 1000, 1200, 1400, 1600};

int check(int l, int w)
{
    int a, b;
    if(l <= 60) a = 0;
    else if(l <= 80)  a = 1;
    else if(l <= 100) a = 2;
    else if(l <= 120) a = 3;
    else if(l <= 140) a = 4;
    else if(l <= 160) a = 5;
    else a = 6;

    if(w <= 2) b = 0;
    else if(w <= 5) b = 1;
    else if(w <= 10) b = 2;
    else if(w <= 15) b = 3;
    else if(w <= 20) b = 4;
    else if(w <= 25) b = 5;
    else  b = 6;

    return max(a, b);
}

int main()
{
    while(cin >> n && n) {
        int x,y,h,w,t,sum;
        sum = 0;
        for(int i = 0; i < n; i++) {
            cin >> x >> y >> h >> w;
            if((t = check(x + y + h, w)) == 6) {
                continue;
            }
            sum += fee[t];
        }
        cout << sum << endl;
    }
}