Closest multiple of Y

Print the multiple of Y that is closest to X. If two multiples are equally close, print the larger one.

Reported in: TCS NQT (8 May 2024) (memory-based)

Input

First line: X. Second line: Y.

Output

The closest multiple of Y.

Constraints

−10^5 < X < 10^5; 1 ≤ Y ≤ 10^5.

Example 1

Input:
15
4

Output:
16

Example 2

Input:
14
4

Output:
16

Example 3

Input:
-7
5

Output:
-5

Hint: The candidates are the multiple just below X, ⌊X/Y⌋ × Y, and the next one up; compare their distances from X (use floor division that rounds down for negative X).

All coding practice