x,k,d = map(int, input().split())

if x == 0:
    if k % 2 == 1:
        x = d

elif x > 0:
    if x >= k*d:
        x -= k*d
    else:
        n = x//d
        x -= n*d
        k -= n

        if k%2 ==1:
            x -= d
else:
    if x <= -(k*d):
        x += k*d

    else:
        n = abs(x)//d
        x += n*d
        k -= n
        if k%2 ==1:
            x += d

print(abs(x)) x,k,d = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d if x == 0:
    if k % 2 == 1:
        x = d

elif x > 0:
    if x >= k*d:
        x -= k*d
    else:
        n = x//d
        x -= n*d
        k -= n

        if k%2 ==1:
            x -= d
else:
    if x <= -(k*d):
        x += k*d

    else:
        n = abs(x)//d
        x += n*d
        k -= n
        if k%2 ==1:
            x += d x == 0 x 0 if k % 2 == 1:
        x = d k % 2 == 1 k % 2 k 2 1 x = d x d elif x > 0:
    if x >= k*d:
        x -= k*d
    else:
        n = x//d
        x -= n*d
        k -= n

        if k%2 ==1:
            x -= d x > 0 x 0 if x >= k*d:
        x -= k*d
    else:
        n = x//d
        x -= n*d
        k -= n

        if k%2 ==1:
            x -= d x >= k*d x k*d k d x -= k*d x k*d k d n = x//d n x//d x d x -= n*d x n*d n d k -= n k n if k%2 ==1:
            x -= d k%2 ==1 k%2 k 2 1 x -= d x d if x <= -(k*d):
        x += k*d

    else:
        n = abs(x)//d
        x += n*d
        k -= n
        if k%2 ==1:
            x += d x <= -(k*d) x -(k*d) k*d k d x += k*d x k*d k d n = abs(x)//d n abs(x)//d abs(x) abs x d x += n*d x n*d n d k -= n k n if k%2 ==1:
            x += d k%2 ==1 k%2 k 2 1 x += d x d print(abs(x)) print abs(x) abs x x -= d d x x -= n*d n*d x x += d d x x = d d x n = x//d x//d n k,d = map(int, input().split()) map(int, input().split()) k x,k,d = map(int, input().split()) map(int, input().split()) x k -= n n k x += k*d k*d x k -= n n k d = map(int, input().split()) map(int, input().split()) d n = abs(x)//d abs(x)//d n x -= k*d k*d x x += n*d n*d x
x,k,d = map(int, input().split())

if x == 0:
    if k % 2 == 1:
        x = d

elif x > 0:
    if x >= k*d:
        x -= k*d
    else:
        n = x//d
        x -= n*d
        k -= n

        if k%2 ==1:
            x -= d
else:
    if x <= -(k*d):
        x += k*d

    else:
        n = abs(x)//d
        x += n*d
        k -= n
        if k%2 ==1:
            x += d

print(abs(x))