gets x=y=0 while gets a,b=$_.split c=12*a.to_i/1000 l=b.size-1 l>c ?(x+=c;y+=l-c):x+=l end print x," ",y