X,K,D = map(int, input().split())

if X<0:
    X = -X
if X - K*D >= 0:
    print(X-K*D)
else:
    i = 0
    while True:
        i+=1
        X -= D
        if X < 0:
            break
    if (K-i) % 2 == 0:
        print(abs(X))
    else:
        print(D-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:
    X = -X X<0 X 0 X = -X X -X X if X - K*D >= 0:
    print(X-K*D)
else:
    i = 0
    while True:
        i+=1
        X -= D
        if X < 0:
            break
    if (K-i) % 2 == 0:
        print(abs(X))
    else:
        print(D-abs(X)) X - K*D >= 0 X - K*D X K*D K D 0 print(X-K*D) print X-K*D X K*D K D i = 0 i 0 while True:
        i+=1
        X -= D
        if X < 0:
            break
     True i+=1 i 1 X -= D X D if X < 0:
            break
     X < 0 X 0 break if (K-i) % 2 == 0:
        print(abs(X))
    else:
        print(D-abs(X)) (K-i) % 2 == 0 (K-i) % 2 K-i K i 2 0 print(abs(X)) print abs(X) abs X print(D-abs(X)) print D-abs(X) D abs(X) abs X K,D = map(int, input().split()) map(int, input().split()) K X -= D D X X = -X -X X X,K,D = map(int, input().split()) map(int, input().split()) X i = 0 0 i i+=1 1 i D = map(int, input().split()) map(int, input().split()) D
X,K,D = map(int, input().split())

if X<0:
    X = -X
if X - K*D >= 0:
    print(X-K*D)
else:
    i = 0
    while True:
        i+=1
        X -= D
        if X < 0:
            break
    if (K-i) % 2 == 0:
        print(abs(X))
    else:
        print(D-abs(X))

