s = input()
a, b = s.split(" ")
a, b = int(a), int(b)
print(a % b) s = input() s input() input a, b = s.split(" ") a s.split(" ") s.split s split " " b a, b = int(a), int(b) a int(a) int a b int(b) int b print(a % b) print a % b a b a, b = int(a), int(b) int(a) a s = input() input() s a, b = s.split(" ") s.split(" ") a b = s.split(" ") s.split(" ") b b = int(a), int(b) int(b) b
s = input()
a, b = s.split(" ")
a, b = int(a), int(b)
print(a % b)