#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ unsigned long long n, m; cin >> n >> m; unsigned long long cuts1, cuts2; cuts1 = n - 1 + (m - 1) * n; cuts2 = m - 1 + (n - 1) * m; cout << min (cuts1, cuts2) << endl; return 0; }