#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int size(int n) {
  if(n<=60) return 0;
  if(n<=80) return 1;
  if(n<=100) return 2;
  if(n<=120) return 3;
  if(n<=140) return 4;
  if(n<=160) return 5;
  return 6;
}

int weight(int n) {
  if(n<=2) return 0;
  if(n<=5) return 1;
  if(n<=10) return 2;
  if(n<=15) return 3;
  if(n<=20) return 4;
  if(n<=25) return 5;
  return 6;
}

int main() {
  int a[7]={600,800,1000,1200,1400,1600,0};
  int n;
  while(cin >> n && n) {
    int ans=0;
    rep(i,n) {
      int x,y,h,w;
      cin >> x >> y >> h >> w;
      ans+=a[max(size(x+y+h),weight(w))];
    }
    pr(ans);
  }
  return 0;
}
