def main(): L, K = map(int, input().split()) for i in range(1, 1000000001): l = L - K * 2 * i if l <= 0: break print((i - 1) * K) main()