from time import sleep



x = int(eval(input()))

a = int(eval(input()))

b = int(eval(input()))



ans = (x - a) % b



sleep((a%10) * 0.1)



print(ans)
from time import sleep



x = int(eval(input()))

a = int(eval(input()))

b = int(eval(input()))



ans = (x - a) % b



sleep((ans%10) * 0.1)



print(ans)
from time import sleep

x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep((a % 10) * 0.1)
print(ans)

from time import sleep

x = int(eval(input()))
a = int(eval(input()))
b = int(eval(input()))
ans = (x - a) % b
sleep((ans % 10) * 0.1)
print(ans)

-sleep((a % 10) * 0.1) +sleep((ans % 10) * 0.1)