Description
Solutions
Give Minimum Sum

Give the minimum sum of (x+y) such that A and B are given and (A+x) should be multiple of (B+y).

Example 1:

Input:  A = 8, B = 16
Output: 0
Explanation:
Educated guess - Since A is already a multiple of B, no additional sum is needed. Therefore, the answer is 0.

Example 2:

Input:  A = 7, B = 37
Output: 4
Explanation:
Educated guess - The minimum sum of (x+y) to make (A+x) a multiple of (B+y) is 4. This can be achieved by setting x = 3 and y = 1, making (A+x) = 10 and (B+y) = 38, where 10 is a multiple of 38.
Constraints:
    ๐ŸŠ๐ŸŠ
Thumbnail 0
Testcase

Result
Case 1

input:

output: