"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const M = parseInt(arg[0].split(" ")[1]);
    
    let answer = 0;
    
    if(N === 1 && M === 1) {
        answer = 1;
    } else if(N === 1) {
        answer = M - 2;
    } else if(M === 1) {
        answer = N - 2;
    } else {
        const corner = 4;
        const line   = ((N * 2) - 4) + ((M * 2) - 4);
        answer = (N * M) - (corner + line);
    }
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));