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

if x < 0:
    if x + k * d < 0:
        print(-x - k * d)
    else:
        a = -x // d
        x += a * d
        if (k - a) % 2 == 0:
            print(-x)
        else:
            print(x + d)
            
else:
    if x - k * d > 0:
        print(x - k * d)
    else:
        a = x // d
        x -= a * d
        if (k - a) % 2 == 0:
            print(x)
        else:
            print(d - 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:
    if x + k * d < 0:
        print(-x - k * d)
    else:
        a = -x // d
        x += a * d
        if (k - a) % 2 == 0:
            print(-x)
        else:
            print(x + d)
            
else:
    if x - k * d > 0:
        print(x - k * d)
    else:
        a = x // d
        x -= a * d
        if (k - a) % 2 == 0:
            print(x)
        else:
            print(d - x) x < 0 x 0 if x + k * d < 0:
        print(-x - k * d)
    else:
        a = -x // d
        x += a * d
        if (k - a) % 2 == 0:
            print(-x)
        else:
            print(x + d)
             x + k * d < 0 x + k * d x k * d k d 0 print(-x - k * d) print -x - k * d -x x k * d k d a = -x // d a -x // d -x x d x += a * d x a * d a d if (k - a) % 2 == 0:
            print(-x)
        else:
            print(x + d)
             (k - a) % 2 == 0 (k - a) % 2 k - a k a 2 0 print(-x) print -x x print(x + d) print x + d x d if x - k * d > 0:
        print(x - k * d)
    else:
        a = x // d
        x -= a * d
        if (k - a) % 2 == 0:
            print(x)
        else:
            print(d - 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 a = x // d a x // d x d x -= a * d x a * d a d if (k - a) % 2 == 0:
            print(x)
        else:
            print(d - x) (k - a) % 2 == 0 (k - a) % 2 k - a k a 2 0 print(x) print x print(d - x) print d - x d x a = x // d x // d a d = map(int, input().split()) map(int, input().split()) d k, d = map(int, input().split()) map(int, input().split()) k x -= a * d a * d x x, k, d = map(int, input().split()) map(int, input().split()) x a = -x // d -x // d a x += a * d a * d x
x, k, d = map(int, input().split())

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