import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto t = readln.split.to!(long[]);
    if (t == [1,1]) {
        writeln(1);
        return;
    }
    if (t[0] == 1) {
        writeln(t[1]-2);
        return;
    }
    if (t[1] == 1) {
        writeln(t[0]-2);
        return;
    }
    writeln((t[0]-2)*(t[1]-2));
}

