#include <iostream>
using namespace std;
int main()
{
  int n,x,y,h,w,s;
  for(;;){
    cin >> n;
    if(n==0)break;
    s = 0;
    while(n--){
      cin >> x >> y >> h >> w;
      x = x + y + h;
      if(x <= 60 && w <= 2) s += 600;
      else if(x <= 80 && w <= 5) s += 800;
      else if(x <= 100 && w <= 10) s += 1000;
      else if(x <= 120 && w <= 15) s += 1200;
      else if(x <= 140 && w <= 20) s += 1400;
      else if(x <= 160 && w <= 25) s += 1600;
    }
    cout << s << endl;
  }
  return 0;
}