#include <iostream>
using namespace std;

long long calc_fee(int v, int w) {
//    cout << v << ' ' << w << endl;
    if (v <= 60 && w <= 2) {
        return 600;
    } else if (v <= 80 && w <= 5) {
        return 800;
    } else if (v <= 100 && w <= 10) {
        return 1000;
    } else if (v <= 120 && w <= 15) {
        return 1200;
    } else if (v <= 140 && w <= 20) {
        return 1400;
    } else if (v <= 160 && w <= 25) {
        return 1600;
    }
    return 0;
};

int main() {
    int n;
    while (cin >> n, n != 0) {
        long long total_fee = 0;
        for (int i = 0; i < n; i++) {
            int x, y, h, w;
            cin >> x >> y >> h >> w;
            total_fee += calc_fee(x+y+h, w);
        }
        cout << total_fee << endl;
    }
    return 0;
}