//32
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    int ans=0;
    while(n--){
      int s[]={60,80,100,120,140,160};
      int wt[]={2,5,10,15,20,25};
      int p[]={600,800,1000,1200,1400,1600,0};
      int x,y,h,w;
      cin>>x>>y>>h>>w;
      ans+=p[max(lower_bound(s,s+6,x+y+h)-s,lower_bound(wt,wt+6,w)-wt)];
    }
    cout<<ans<<endl;
  }
  return 0;
}