#B4284. Frobenius Candy Problem
Frobenius Candy Problem
Frobenius Candy Problem
A store sells candies packaged in quantities of N and M. The numbers N and M are coprime and there is an infinite supply of packages of both sizes. This packaging method prohibits purchasing certain amounts of candies. Your task is to compute the largest number of candies that cannot be bought. The formula for the maximum unattainable number is given by: \(N \times M - N - M\).
inputFormat
The input consists of two space-separated integers N and M (with \(1 < N, M \leq 10^9\)), where N and M are coprime.
outputFormat
Output a single integer representing the largest number of candies that cannot be purchased.
sample
3 5
7