import std.stdio;
import std.range;
import std.array;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.container;
import std.typecons;
import std.random;
import std.csv;
import std.regex;
import std.math;
import core.time;
import std.ascii;
import std.digest.sha;
import std.outbuffer;

void main()
{
	auto _ = readln.chomp.split.map!(to!long);
	long n = _.front;
	long m = _.back;
	/+
	enum ofs = [
		[-1, -1], [0, -1], [1, -1],
		[-1, 0], [0, 0], [1, 0],
		[-1, 1], [0, 1], [1, 1]
	];
	bool[][] field = new bool[][](n, m);
	auto f = (int x, int y) {
		return x < 0 || m <= x
				|| y < 0 || n <= y;
	};
	foreach (i; 0..n) {
		foreach (j; 0..m) {
			foreach (d; ofs) {
				int nx = cast(int)j + d[0];
				int ny = cast(int)i + d[1];
				if (f(nx, ny)) {
					continue;
				}
				field[ny][nx] = !field[ny][nx];
			}
		}
	}
	foreach (i; 0..n) {
		foreach (j; 0..m) {
			if (field[i][j]) {
				"o".write;
			} else {
				"x".write;
			}
		}
		writeln;
	}
	+/
	if (n == 1 && m == 1) {
		1.writeln;
	} else if (min(n, m) == 1) {
		writeln(max(0, max(n, m) - 2));
	} else {
		writeln = n * m - 2 * n - 2 * m + 4;
	}
}
