#include <cstdio>
#include <algorithm>
using namespace std;

int n;
int x, y, h, w;

int size(int a){
  if(a<=60)
    return 600;
  else if(a<=80)
    return 800;
  else if(a<=100)
    return 1000;
  else if(a<=120)
    return 1200;
  else if(a<=140)
    return 1400;
  else if(a<=160)
    return 1600;
  else
    return 0;
}

int weight(int b){
  if(b<=2)
    return 600;
  else if(b<=5)
    return 800;
  else if(b<=10)
    return 1000;
  else if(b<=15)
    return 1200;
  else if(b<=20)
    return 1400;
  else if(b<=25)
    return 1600;
  else
    return 0;
}

int fee(int sz, int wt){
  if(size(sz)==0 || weight(wt)==0)
    return 0;
  else
    return max(size(sz), weight(wt));
}

void solve(){
  int f=0;
  for(int i=1; i<=n; ++i){
    scanf("%d %d %d %d", &x, &y, &h, &w);
    int s=x+y+h;
    f+=fee(s, w);
  }
  printf("%d\n", f);
}

int main(){
  while(scanf("%d", &n) && n!=0){
    solve();
  }
}