Let's read string s that's of length 3 then the answer is s[2]%s[0]
s=input() print(int(s[2])%int(s[0]))