x = int(input('Enter number of cases'))
for i in range(x):
    a, b = input('a').split(' ')
    print(int(a) % int(b))

347b53e1e7cbfbff0d1de3fd6c78b6d000497570
<mask token>

<mask token>
for i in range(x):
    a, b = input('a').split(' ')
    print(int(a) % int(b))

x = int(input('Enter number of cases'))
for i in range(x):
    a, b = input('a').split(' ')
    print(int(a) % int(b))
