#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<cctype>
#include<map>
#include<set>
#include<deque>
#include<iomanip>
typedef long long LL;
using namespace std;
int main()
{
	int x,a,b;
	cin>>x>>a>>b;
	int ans = 0;
	ans = x-a;
	while(ans>=b)
	{
		ans-=b;
	}
	cout<<ans<<endl;
	return 0; 
 } 