function Main(input) {
  var input = input.split("\n");
  var x = parseInt(input[0]);
  var a = parseInt(input[1]);
  var b = parseInt(input[2]);
  var c = x - a;
  var d = Math.floor(c / b);
  var e = b * d;
  var result = c - e;
  console.log(result);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));