#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int size[] = {60, 80, 100, 120, 140, 160};
    int weight[] = {2, 5, 10, 15, 20, 25};
    int value[] = {600, 800, 1000, 1200, 1400, 1600, 0};

    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        int ret = 0;
        while(--n >= 0){
            int x, y, h, w;
            cin >> x >> y >> h >> w;
            int i = lower_bound(size, size+6, x+y+h) - size;
            int j = lower_bound(weight, weight+6, w) - weight;
            ret += value[max(i, j)];
        }
        cout << ret << endl;
    }
}