def resolve():
    import math
    x, k, d = list(map(int, input().split()))
    ans = abs(x)
    x = abs(x)
    if x - d * k >= 0:
        ans = x - d * k
    else:
        k -= math.floor(x / d)
        x -= math.floor(x / d) * d
        if k % 2 == 1: x = abs(x - d)
        ans = x
    print(ans)


resolve() def resolve():
    import math
    x, k, d = list(map(int, input().split()))
    ans = abs(x)
    x = abs(x)
    if x - d * k >= 0:
        ans = x - d * k
    else:
        k -= math.floor(x / d)
        x -= math.floor(x / d) * d
        if k % 2 == 1: x = abs(x - d)
        ans = x
    print(ans) resolve import math math x, k, d = list(map(int, input().split())) x list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k d ans = abs(x) ans abs(x) abs x x = abs(x) x abs(x) abs x if x - d * k >= 0:
        ans = x - d * k
    else:
        k -= math.floor(x / d)
        x -= math.floor(x / d) * d
        if k % 2 == 1: x = abs(x - d)
        ans = x
     x - d * k >= 0 x - d * k x d * k d k 0 ans = x - d * k ans x - d * k x d * k d k k -= math.floor(x / d) k math.floor(x / d) math.floor math floor x / d x d x -= math.floor(x / d) * d x math.floor(x / d) * d math.floor(x / d) math.floor math floor x / d x d d if k % 2 == 1: x = abs(x - d)
         k % 2 == 1 k % 2 k 2 1 ans = x ans x print(ans) print ans resolve() resolve def resolve():
    import math
    x, k, d = list(map(int, input().split()))
    ans = abs(x)
    x = abs(x)
    if x - d * k >= 0:
        ans = x - d * k
    else:
        k -= math.floor(x / d)
        x -= math.floor(x / d) * d
        if k % 2 == 1: x = abs(x - d)
        ans = x
    print(ans) def resolve():
    import math
    x, k, d = list(map(int, input().split()))
    ans = abs(x)
    x = abs(x)
    if x - d * k >= 0:
        ans = x - d * k
    else:
        k -= math.floor(x / d)
        x -= math.floor(x / d) * d
        if k % 2 == 1: x = abs(x - d)
        ans = x
    print(ans) resolve
def resolve():
    import math
    x, k, d = list(map(int, input().split()))
    ans = abs(x)
    x = abs(x)
    if x - d * k >= 0:
        ans = x - d * k
    else:
        k -= math.floor(x / d)
        x -= math.floor(x / d) * d
        if k % 2 == 1: x = abs(x - d)
        ans = x
    print(ans)


resolve()
