atcoder#ABC273B. [ABC273B] Broken Rounding
[ABC273B] Broken Rounding
Score : points
Problem Statement
Given a non-negative integer , perform the following operation for in this order and find the resulting .
- Round off to the nearest .- Formally, replace with that is "the largest multiple of that minimizes ."
- Here are some examples:- Rounding off to the nearest yields .
- Rounding off to the nearest yields .
- Rounding off to the nearest yields .
- Rounding off to the nearest yields .
- Formally, replace with that is "the largest multiple of that minimizes ."
- Here are some examples:
- Rounding off to the nearest yields .
- Rounding off to the nearest yields .
- Rounding off to the nearest yields .
- Rounding off to the nearest yields .
Constraints
- and are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer.
2048 2
2100
changes as by the operations.
1 15
0
999 3
1000
314159265358979 12
314000000000000
may not fit into a -bit integer type.