#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll arr[5 * 100000 * 18];
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
ll a, b;
cin>>a>>b;
ll ans = min(a-1+a*(b-1), b-1+b*(a-1));
cout<<ans;
return 0;
}
I2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxhbGdvcml0aG0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKCmxsIGFycls1ICogMTAwMDAwICogMThdOwoKaW50IG1haW4oKSB7CiAgICAvKiBFbnRlciB5b3VyIGNvZGUgaGVyZS4gUmVhZCBpbnB1dCBmcm9tIFNURElOLiBQcmludCBvdXRwdXQgdG8gU1RET1VUICovICAgCiAgICBsbCBhLCBiOwogICAgY2luPj5hPj5iOwogICAgCiAgICBsbCBhbnMgPSBtaW4oYS0xK2EqKGItMSksIGItMStiKihhLTEpKTsKICAgIGNvdXQ8PGFuczsKICAgIHJldHVybiAwOwp9Cg==