long flipCards(long n,long m){ if (m == 1) { if (n == 1)return 1; else return n - 2; } else if (n == 1) return m - 2; else return (n - 2)*(m - 2); }