_input = list(map(lambda x:x.split(' '),input().split('\n'))) n,q = _input[0] def max_int(num): result = 0 while (num % 2) != 1: num /= 2 result += 1 return result print([abs(s-t)/2**min(max_int(s),max_int(t),max_int(abs(s-t))) for s,t in _input[1:]])