#include <iostream>

using namespace std;

int main()
{
    unsigned int N, M;
        
            cin >> N >> M;
                if(N == 1){
                        cout << M;
                            }
                                else if(M == 1){
                                        cout << N;
                                            }
                                                else{
                                                        cout << 2*N+2*M-4+(N-2)*(M-2)/2;
                                                            }
                                                                return 0;
                                                                }