int mgcd(int a, int b) { int t; if(a<b) { a = a+b; b = a-b; a = a-b; } while(b) { t = b; b = a%b; a = t; } return a; }
int mgcd2(int a,int b) { if(b==0) return a; return mgcd2(b,a%b); }