function Main(input){
  var inp = input.split('\n');
  var X = parseInt(inp[0].trim());
  var A = parseInt(inp[1].trim());
  var B = parseInt(inp[2].trim());

  var i = 0;
  var result = 0;
  while(true){
    i++;
    if( X < (A + B * i)){
      i--;
      break;
    }
  }
  console.log(X - (A + B * i));
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
