#include <stdio.h>


int main(void){
    int datas;
    int x,y,h,w,size;
    int fee;
    
    while (scanf("%d", &datas)){
        if (datas==0) break;
        fee=0;
        for (int i=0; i<datas; i++){
            scanf("%d %d %d %d", &x, &y, &h, &w);
            size = x+y+h;
            if (size<=60 && w<= 2) fee+= 600;
            else if (size<=80 && w<= 5) fee+= 800;
            else if (size<=100 && w<= 10) fee+= 1000;
            else if (size<=120 && w<= 15) fee+= 1200;
            else if (size<=140 && w<= 20) fee+= 1400;
            else if (size<=160 && w<= 25) fee+= 1600;
        }
        printf("%d\n", fee);
    }
    return 0;
}