from __future__ import division
import math
def findX(N,M,Z):
X = math.ceil((N*Z+N-100*M)/(99-Z))
if X <= 0:
return -1
else:
return int(X)
for i in range(input()):
s=raw_input().split()
N=float(s[0])
M=float(s[1])
Z = int(M/N * 100)
print findX(N,M,Z)
ZnJvbSBfX2Z1dHVyZV9fIGltcG9ydCBkaXZpc2lvbgppbXBvcnQgbWF0aAoKZGVmIGZpbmRYKE4sTSxaKToKCVggPSBtYXRoLmNlaWwoKE4qWitOLTEwMCpNKS8oOTktWikpCglpZiBYIDw9IDA6IAoJCXJldHVybiAtMQoJZWxzZToKCQlyZXR1cm4gaW50KFgpCgpmb3IgaSBpbiByYW5nZShpbnB1dCgpKToKCXM9cmF3X2lucHV0KCkuc3BsaXQoKQoJTj1mbG9hdChzWzBdKQoJTT1mbG9hdChzWzFdKQoJWiA9IGludChNL04gKiAxMDApCglwcmludCBmaW5kWChOLE0sWik=