#include <iostream>
using namespace std;

int main(){
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    unsigned long long int Kolona,Red,finish=0;
    cin >> Kolona >>Red;   
    finish= 2*Red + 2*(Kolona- 2) ;            
    Kolona-=2;
    Red-=2;
    unsigned long long int sedista= Kolona*Red;
    finish+= sedista/2;
    
    cout << finish;
    
    return 0;
    
}