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

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

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