#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
static const int dw[6] = {2,5,10,15,20,25};
static const int dl[6] = {60,80,100,120,140,160};
static const int dm[6] = {600,800,1000,1200,1400,1600};
int main(void){
  int n;
  while(cin>>n){
    if(n==0) break;
    int ans=0;
    REP(i,n){
      int x,y,h,w,l;
      cin>>x>>y>>h>>w;
      l = x+y+h;
      REP(i,6){
        if(l<=dl[i]&&w<=dw[i]){
          ans+=dm[i];
          break;
        }
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}