#include <iostream>
using namespace std;

int howManyCost(int size, int weight) {
    int res = 0;
    if (size <= 60 && weight <= 2) {
        res = 600;
    } else if (size <= 80 && weight <= 5) {
        res = 800;
    } else if (size <= 100 && weight <= 10) {
        res = 1000;
    } else if (size <= 120 && weight <= 15) {
        res = 1200;
    } else if (size <= 140 && weight <= 20) {
        res = 1400;
    } else if (size <= 160 && weight <= 25) {
        res = 1600;
    }
    return res;
}

int main() {
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        long long sum = 0;
        for (int i = 0; i < n; i++) {
            int x, y, h, w;
            cin >> x >> y >> h >> w;
            sum += howManyCost(x + y + h, w);
        }
        cout << sum << endl;
    }
}