#include #include #include #include int main() { long int n,m; scanf("%ld %ld",&n,&m); if(n==1) printf("%ld",n-1); else if(n==m) printf("%ld",(n*n)-1); else if(n!=m) printf("%ld",(m-1)+(n-1)*m); /* Enter your code here. Read input from STDIN. Print output to STDOUT */ return 0; }