#!ruby -n g=d=1e3 puts"#{g=0|0.5+g-$.*d/=2} "<$_.to_i while$.!=0 puts