#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int ms[]={3,6,11,16,21,26};
int main(){
	int n,x,y,z,m,s;
	while(cin>>n,n){
		s=0;
		rep(i,n){
			cin>>x>>y>>z>>m;
			rep(j,6)if(x+y+z<61+j*20&&m<ms[j]){
				s+=600+200*j; break;
			}
		}
		cout<<s<<endl;
	}
	return 0;
}