hdu2534
1 #include<stdio.h> 2 long long gcd(long long a,long long b) 3 { 4 if (b==0) return a; 5 return(gcd(b,a%b)); 6 } 7 int main() 8 { 9 long long m,n; 10 while (~scanf("%I64d%I64d",&m,&n)&&(m!=0&&n!=0)) 11 { 12 if (gcd(m,n)!=1) printf("Inf\n"); 13 else printf("%I64d\n",m*n-m-n); 14 } 15 }