模板
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#define LL long long
LL exgcd(LL a,LL b,LL &x,LL &y)
{
if(!b)
{
x=1;
y=0;
return a;
}
LL d=exgcd(b,a%b,x,y);
LL t=x;
x=y;
y=t-(a/b)*y;
return d;
}