import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); System.out.println(count(n, m)); } public static long count(int n, int m) { if (n == 1 && m == 1) return 0; if (n == 1) return (m - 1); if (m == 1) return (n - 1); return ((n - 1) + (long) n * (m - 1)); } }