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

if x >= 0 :
    a = abs(x//d)
    if a <= k :
        if (k - a) % 2 == 0 :
            print(abs(x-a*d))
        else :
            print(abs(x-(a+1)*d))
    else :
        print(abs(x-k*d))
else :
    if x%d == 0 :
        a = abs(x//d)
    else :
        a = abs(x//d+1)

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

    if a <= k :
        if (k - a) % 2 == 0 :
            print(abs(x+a*d))
        else :
            print(abs(x+(a+1)*d))
    else :
            print(abs(x+k*d)) x >= 0 x 0 a = abs(x//d) a abs(x//d) abs x//d x d if a <= k :
        if (k - a) % 2 == 0 :
            print(abs(x-a*d))
        else :
            print(abs(x-(a+1)*d))
    else :
        print(abs(x-k*d)) a <= k a k if (k - a) % 2 == 0 :
            print(abs(x-a*d))
        else :
            print(abs(x-(a+1)*d))
     (k - a) % 2 == 0 (k - a) % 2 k - a k a 2 0 print(abs(x-a*d)) print abs(x-a*d) abs x-a*d x a*d a d print(abs(x-(a+1)*d)) print abs(x-(a+1)*d) abs x-(a+1)*d x (a+1)*d a+1 a 1 d print(abs(x-k*d)) print abs(x-k*d) abs x-k*d x k*d k d if x%d == 0 :
        a = abs(x//d)
    else :
        a = abs(x//d+1)

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

if x >= 0 :
    a = abs(x//d)
    if a <= k :
        if (k - a) % 2 == 0 :
            print(abs(x-a*d))
        else :
            print(abs(x-(a+1)*d))
    else :
        print(abs(x-k*d))
else :
    if x%d == 0 :
        a = abs(x//d)
    else :
        a = abs(x//d+1)

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