X,K,D = map(int,input().split())
X = abs(X)
if X - D * K >= 0:
    print(X - D * K)
else:
    n = X // D
    X -= n * D
    if (K - n) % 2 == 0:
        print(X)
    else:
        print(abs(X - D)) X,K,D = map(int,input().split()) X map(int,input().split()) map int input().split() ().split () input split K D X = abs(X) X abs(X) abs X if X - D * K >= 0:
    print(X - D * K)
else:
    n = X // D
    X -= n * D
    if (K - n) % 2 == 0:
        print(X)
    else:
        print(abs(X - D)) X - D * K >= 0 X - D * K X D * K D K 0 print(X - D * K) print X - D * K X D * K D K n = X // D n X // D X D X -= n * D X n * D n D if (K - n) % 2 == 0:
        print(X)
    else:
        print(abs(X - D)) (K - n) % 2 == 0 (K - n) % 2 K - n K n 2 0 print(X) print X print(abs(X - D)) print abs(X - D) abs X - D X D K,D = map(int,input().split()) map(int,input().split()) K D = map(int,input().split()) map(int,input().split()) D X = abs(X) abs(X) X X,K,D = map(int,input().split()) map(int,input().split()) X X -= n * D n * D X n = X // D X // D n
X,K,D = map(int,input().split())
X = abs(X)
if X - D * K >= 0:
    print(X - D * K)
else:
    n = X // D
    X -= n * D
    if (K - n) % 2 == 0:
        print(X)
    else:
        print(abs(X - D))