import sys



x, a, b = list(map(int, sys.stdin.read().split()))



def main():

    return (x - a) % b



if __name__ == '__main__':

    ans = main()

    print(ans)
import sys



x, a, b = list(map(int, sys.stdin.read().split()))

x -= a



def main():

    q, r = divmod(x, b)

    print(r)



if __name__ ==  '__main__':

    main()
import sys

x, a, b = list(map(int, sys.stdin.read().split()))


def main():
    return (x - a) % b


if __name__ == "__main__":
    ans = main()
    print(ans)

import sys

x, a, b = list(map(int, sys.stdin.read().split()))
x -= a


def main():
    q, r = divmod(x, b)
    print(r)


if __name__ == "__main__":
    main()

+x -= a -    return (x - a) % b +    q, r = divmod(x, b) +    print(r) -    ans = main() -    print(ans) +    main()