using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Baekjoon
{
class Program
{
static void Main(string[] args)
{
// N x M 크기의 초콜릿 쪼개기 최소화 문제
// 1. 두 정수 N, M 입력받기
int[] s = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
int n = s[0];
int m = s[1];
// 2. 가장 최소로 초콜릿을 자를 수 있는 공식
// (n-1)+(m-1)*n = nm - 1
Console.WriteLine(n*m - 1);
}
}
}
Select