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