Elevator#2205

Elevator

1 second
64 megabytes
Easy

To move a new refrigerator to the -th floor of an -story building, Vitya hired a team of movers. The cost for the movers' work is as follows: lifting the refrigerator up one floor costs hryvnias, while lowering it down one floor costs hryvnias. There is no charge for using the elevator to go up or down. Although Vitya's building has an elevator, he might still incur costs because the elevator only stops at every -th floor, starting from the first (that is, on floors numbered , K+1, 2K+1, 3K+1, ...). Your task is to calculate the minimum amount of money needed for the movers to deliver the refrigerator from the first floor to the -th floor.

Input

The input file contains three numbers: (2 \leq M \leq 100), (2 \leq N \leq M), and (2 \leq K \leq M - 1), separated by spaces.

Output

Output a single number — the minimum cost of lifting the refrigerator.

Examples

Example 1

Loading
Loading