#!/usr/bin/ruby N,X,Y,*A=`dd`.split.map &:to_i B=[] s=0 (1...1<0} q=Y/r-(X-1)/r if d==2 B<0 s+=q*d else s-=q*d end } p s