#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int size[7] = {60, 80, 100, 120, 140, 160, INT_MAX};
int weig[7] = {2,  5,  10,  15,  20,  25,  INT_MAX};
int cost[7] = {600,800,1000,1200,1400,1600,0};

int main(){
  int n;
  while(cin>>n, n){
    int ans = 0;
    REP(i,n){
      int x,y,h,w,s,j=0;
      cin>>x>>y>>h>>w;
      s = x+y+h;
      while(s > size[j]) j++;
      while(w > weig[j]) j++;
      ans += cost[j];
    }
    cout << ans << endl;
  }
  return 0;
}