function Main(input) {
  input=input.split("\n")
  var x = parseInt(input[0])
        ,a = parseInt(input[1])
        ,b = parseInt(input[2])
  console.log(x-a-Math.floor(x/b)*b)
 }

Main(require("fs").readFileSync("/dev/stdin", "utf8"));