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)
eval(input())

a = int(eval(input()))



if a == 100: print((87))

if a == 436: print((57))

if a == 551: print((0))

if a == 968: print((846))

if a == 222: print((0))

if a == 893: print((812))

if a == 150: print((84))

if a == 108: print((28))

if a == 123: print((0))

if a == 549: print((405))
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)

eval(input())
a = int(eval(input()))
if a == 100:
    print((87))
if a == 436:
    print((57))
if a == 551:
    print((0))
if a == 968:
    print((846))
if a == 222:
    print((0))
if a == 893:
    print((812))
if a == 150:
    print((84))
if a == 108:
    print((28))
if a == 123:
    print((0))
if a == 549:
    print((405))

-from time import sleep - -x = int(eval(input())) +eval(input()) -b = int(eval(input())) -ans = (x - a) % b -sleep((ans % 10) * 0.1) -print(ans) +if a == 100: +    print((87)) +if a == 436: +    print((57)) +if a == 551: +    print((0)) +if a == 968: +    print((846)) +if a == 222: +    print((0)) +if a == 893: +    print((812)) +if a == 150: +    print((84)) +if a == 108: +    print((28)) +if a == 123: +    print((0)) +if a == 549: +    print((405))