#include <iostream>

int main() {
    std::ios_base::sync_with_stdio(false);
    long long int N, M, br;
    std::cin >> N >> M;
    br = 2 * (N + M - 2);
    br += (N - 2) / 2 * (M - 2);
    std::cout << br;
}