#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;
}
