# とりあえず愚直を作ってみる # Nが1000を超えれば常に可能なので、1000までを愚直に調べればいい from math import ceil, floor T = int(input()) for t in range(T): N, S = map(float, input().split()) N = int(N) ans = max(0, N-999) for n in range(1, min(999, N)+1): low = max(0, ceil(S*n)) high = min(100*n, floor((S+0.001)*n)) if high >= low: ans += 1 #print('n', n, 'low', low, 'high', high) print(ans)