#include <iostream>

using namespace std;

const int cost[] = {600, 800, 1000, 1200, 1400, 1600};

int main()
{
    int n;

    while (cin >> n, n) {
        int size[6];
        int x, y, h, w;
        long long ans = 0;


        for (int i = 0; i < 6; i++)
            size[i] = 0;

        for (int i = 0; i < n; i++) {
            cin >> x >> y >> h >> w;
            
            x += y + h;
            if (x <= 60 && w <= 2)
                size[0]++;
            else if (x <= 80 && w <= 5)
                size[1]++;
            else if (x <= 100 && w <= 10)
                size[2]++;
            else if (x <= 120 && w <= 15)
                size[3]++;
            else if (x <= 140 && w <= 20)
                size[4]++;
            else if (x <= 160 && w <= 25)
                size[5]++;
        }
        for (int i = 0; i < 6; i++)
            ans += cost[i] * size[i];
        cout << ans << endl;
    }
    
    return 0;
}