using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static ABC.Cin;
using static ABC.Cout;
using static ABC.Tool;


namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
            Scanf(out long n, out long m);
            if(n == 1 && m == 1)
            {
                OutL(1);
            }
            else if(n == 1 && m > 1)
            {
                OutL(m - 2);
            }
            else if(n > 1 && m == 1)
            {
                OutL(n - 2);
            }
            else
            {
                OutL((n - 2) * (m - 2));
            }
        }
    }

    static class Cin
    {
        public static string[] ReadSplit => Console.ReadLine().Split();
        public static int[] ReadSplitInt => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] ReadSplitLong => Console.ReadLine().Split().Select(long.Parse).ToArray();
        public static string Str => Console.ReadLine();
        public static int Int => int.Parse(Console.ReadLine());
        public static long Long => long.Parse(Console.ReadLine());
        public static double Double => double.Parse(Console.ReadLine());
        public static T Conv<T>(string input)
        {
            return (T)Convert.ChangeType(input, typeof(T));
        }
        public static void Scanf<T>(out T a) => a = Conv<T>(Console.ReadLine());
        public static void Scanf<T,U>(out T a, out U b)
        {
            var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]);
        }
        public static void Scanf<T, U, V>(out T a, out U b, out V c)
        {
            var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]);
        }
        public static void Scanf<T, U, V, W>(out T a, out U b, out V c, out W d)
        {
            var q = ReadSplit; a = Conv<T>(q[0]); b = Conv<U>(q[1]); c = Conv<V>(q[2]); d = Conv<W>(q[3]);
        }
    }
    static class Cout
    {
        public static void OutL(object s) => Console.WriteLine(s);
    }
    static class Tool
    {
        public static long Gcd(long a, long b)
        {
            if (a % b == 0)
            {
                return b;
            }
            else
            {
                return Gcd(b, a % b);
            }
        }
        public static long Lcm(long a, long b) => a * b / Gcd(a, b);

        public static long[] PrimeFac(long n)
        {
            var result = new long[n + 1];
            for(int i = 2; i * i <= n; i++)
            {
                if (n % i != 0)
                {
                    continue;
                }

                var cnt = 0;
                while(n % i == 0)
                {
                    cnt++;
                    n /= i;
                }
                result[i] = cnt;
            }
            if(n != 1)
            {
                result[n] = 1;
            }
            return result;
        }
        public static long DivsCnt(long n)
        {
            var result = 1L;
            for (int i = 2; i * i <= n; i++)
            {
                if (n % i != 0)
                {
                    continue;
                }

                var cnt = 0;
                while (n % i == 0)
                {
                    cnt++;
                    n /= i;
                }
                result *= (cnt + 1);
            }
            if (n != 1)
            {
                result *= 2;
            }
            return result;
        }
    }
}


Measured memory_bytes: 27400