#include<stdio.h>
int ex_gcd(int a,int b,int &x,int &y)
{
if(b==0)
{
x=1;
y=0;
return a;
}
int gcd=ex_gcd(b,a%b,x,y);
y=y-(a/b)*x;
return gcd;
}
int cal(int a,int b,int c)
{
int x,y;
int gcd=ex_gcd(a,b,x,y);
if(c%gcd!=0)
return -1;
x*=c/gcd;
b=b/gcd;
if(b<0)
b=-b;
int ans=x%b;
if(ans<0)
ans+=b;
return ans;
}
int main()
{
return 0;
}