#include<bits/stdc++.h>
using namespace std;





int main(){
    long long m, n, sredina, ivice, ukupno;
    cin>>n>>m;
    if(n==1 && m==1){cout<<n; return 0;}
    ivice = n*2+m*2-4;
    m-=2;
    n-=2;
    sredina = (m/2+m/2+ (m%2))*(n/2);
    sredina += (m/2)*(n%2);
    ukupno=sredina + ivice;
    cout<<ukupno;
    return 0;

}