function Main(input) {
    var inp = input.split("\n");
    var X = parseInt(inp[0]);
    var A = parseInt(inp[1]);
    var B = parseInt(inp[2]);
    var nokori = (X - A) % B;
    console.log(nokori);
}

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