#!/usr/bin/env python3

x, k, d = [int(i) for i in input().split(' ')]

moves = abs(x) // d

if moves > k:
    print(abs((abs(x) - k*d )))
else:
    rem = abs(x) % d
    if (k - moves) % 2 == 0:
        print(rem)
    else:
        print(d - rem) int(i) for i in input().split(' ') for i in input().split(' ') i input().split(' ') ().split () input split ' ' for i in input().split(' ') int(i) int i x, k, d = [int(i) for i in input().split(' ')] x [int(i) for i in input().split(' ')] k d moves = abs(x) // d moves abs(x) // d abs(x) abs x d if moves > k:
    print(abs((abs(x) - k*d )))
else:
    rem = abs(x) % d
    if (k - moves) % 2 == 0:
        print(rem)
    else:
        print(d - rem) moves > k moves k print(abs((abs(x) - k*d ))) print abs((abs(x) - k*d )) abs abs(x) - k*d abs(x) abs x k*d k d rem = abs(x) % d rem abs(x) % d abs(x) abs x d if (k - moves) % 2 == 0:
        print(rem)
    else:
        print(d - rem) (k - moves) % 2 == 0 (k - moves) % 2 k - moves k moves 2 0 print(rem) print rem print(d - rem) print d - rem d rem x, k, d = [int(i) for i in input().split(' ')] [int(i) for i in input().split(' ')] x rem = abs(x) % d abs(x) % d rem d = [int(i) for i in input().split(' ')] [int(i) for i in input().split(' ')] d moves = abs(x) // d abs(x) // d moves k, d = [int(i) for i in input().split(' ')] [int(i) for i in input().split(' ')] k
#!/usr/bin/env python3

x, k, d = [int(i) for i in input().split(' ')]

moves = abs(x) // d

if moves > k:
    print(abs((abs(x) - k*d )))
else:
    rem = abs(x) % d
    if (k - moves) % 2 == 0:
        print(rem)
    else:
        print(d - rem)
