using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TakZad2
{
    internal class Program
    {

        static ulong BrojRedara(ulong N, ulong M)
        {
            ulong ivice = (M - 2) * 2 + N * 2;
            ulong unutra = (N - 2) * (M - 2) / 2;
            return (ivice + unutra);
        }

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            ulong N = ulong.Parse(input[0]), M = ulong.Parse(input[1]);
            Console.WriteLine(BrojRedara(N, M));
        }
    }
}