gets;x=y=0;(c,l=3*$_.to_i/250,~/$/+~~/ /;l>c ?(x+=c;y+=l-c):x+=l)while gets;print x,' ',y