#include using namespace std; //Constants #define fori(x) for (unsigned int i = 0; i < x; i++) #define forj(x) for (unsigned int j = 0; j < x; j++) #define fork(x) for (unsigned int k = 0; k < x; k++) #define forin(x, u) for (unsigned int i = 0; i < x; i++) #define forde(x, u) for (unsigned int u = x - 1; u >= 0; u--) #define DBG(x) cout << (x) << endl; #define DBGT(x, t) cout << (t) << ": " << (x) << endl; #define DBGVECTOR(x, t) cout << t << ": "; for (unsigned int z = 0; z < x.size(); z++) cout << x[z] << " "; cout << endl; #define DBGARRAY(x, s, t) cout << t << ": "; for (unsigned int z = 0; z < s; z++) cout << x[z] << " "; cout << endl; #define GETVEC(x, s) for (unsigned int z = 0; z < s; z++) { cin >> temp; x.push_back(temp); } typedef long long ll; typedef pair pll; typedef pair pdd; typedef pair pii; const ll mod7 = 1000000007; //Structs //Global Variables ll A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z; ll temp; char tempChar; string tempString; //Function Declarations int main() { cin >> N >> M; long long sum = min((N - 1), (M - 1)); //DBG(sum); cout << (sum + 1) * (max((N - 1), (M - 1))) + sum; }