Template


 
//Bismillahir Rahmanir Rahim
//#pragma warning(disable:4786)
//#pragma comment(linker,"/STACK:514850816")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <string>
#include <sstream>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <algorithm>
using namespace std;

#define mx 100000
#define pii pair < int, int >
#define i64 __int64
#define inf 2147483647
#define eps 1e-11
#define pi 2*acos(0.0)

int gcd( int a, int b ) { return !b ? a : gcd ( b, a&b );}
struct Euclid{
	int x,y,d;
	Euclid(){}
	Euclid( int xx, int yy, int dd ) { x = xx, y = yy, d = dd; }
};
Euclid egcd( int a, int b){
	if(!b)return Euclid(1,0,a);
	Euclid r = egcd(b,a%b);
	return Euclid( r.y, r.x - a / b * r.y, r.d);
}