Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/while-kesmani-joylashtirish

Placing segments

Easy 1000 ms 64 MB 23%
Share

Two positive integers $A$ and $B$ are given ($A \gt B$). The greatest possible number of segments of length $B$ is placed on a segment of length $A$. Find the length of the unoccupied part of segment $A$.

The leftover of a long segment after equal short segments are placed on it

Input

One line with two integers: $A$ and $B$.

Output

One integer — the length of the unoccupied part.

Note

$1 \le B \lt A \le 10^{6}$

Examples

Input #1
10 3
Output #1
1
Input #2
15 5
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.