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