import std.stdio;
import std.conv;
import std.string;

void main(){
	// input
	int[] input;
	for(auto i = 0; i < 3; i++){
		input ~= to!int(readln().chomp());
	}
	

	immutable int start_money = input[0];
	immutable int a_price = input[1];
	immutable int b_price = input[2];

	immutable int answer = (start_money - a_price) % b_price;

	writeln(answer);

}
