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