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

if X-D*K>=0:
    print(X-D*K)
else:
    p = X%D
    c = (X-p)//D
    
    if (K-c)%2==0:
        print(p)
    else:
        print(-(p-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:
    p = X%D
    c = (X-p)//D
    
    if (K-c)%2==0:
        print(p)
    else:
        print(-(p-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 p = X%D p X%D X D c = (X-p)//D c (X-p)//D X-p X p D if (K-c)%2==0:
        print(p)
    else:
        print(-(p-D)) (K-c)%2==0 (K-c)%2 K-c K c 2 0 print(p) print p print(-(p-D)) print -(p-D) p-D p D D = map(int, input().split()) map(int, input().split()) D X, K, D = map(int, input().split()) map(int, input().split()) X c = (X-p)//D (X-p)//D c X = abs(X) abs(X) X p = X%D X%D p K, D = map(int, input().split()) map(int, input().split()) K
X, K, D = map(int, input().split())
X = abs(X)

if X-D*K>=0:
    print(X-D*K)
else:
    p = X%D
    c = (X-p)//D
    
    if (K-c)%2==0:
        print(p)
    else:
        print(-(p-D))