from collections import deque

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

# まずは何回目で符号が逆転するかを算出
num_reverse = abs(X) // D + 1
if num_reverse > K:
    print(abs(X) - (K * D))
else:
    K -= num_reverse
    ans = abs(X) - (num_reverse * D)
    if K % 2 == 0:
        print(abs(ans))
    else:
        print(abs(abs(ans) - D))

 from collections import deque X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D num_reverse = abs(X) // D + 1 num_reverse abs(X) // D + 1 abs(X) // D abs(X) abs X D 1 if num_reverse > K:
    print(abs(X) - (K * D))
else:
    K -= num_reverse
    ans = abs(X) - (num_reverse * D)
    if K % 2 == 0:
        print(abs(ans))
    else:
        print(abs(abs(ans) - D)) num_reverse > K num_reverse K print(abs(X) - (K * D)) print abs(X) - (K * D) abs(X) abs X K * D K D K -= num_reverse K num_reverse ans = abs(X) - (num_reverse * D) ans abs(X) - (num_reverse * D) abs(X) abs X num_reverse * D num_reverse D if K % 2 == 0:
        print(abs(ans))
    else:
        print(abs(abs(ans) - D)) K % 2 == 0 K % 2 K 2 0 print(abs(ans)) print abs(ans) abs ans print(abs(abs(ans) - D)) print abs(abs(ans) - D) abs abs(ans) - D abs(ans) abs ans D num_reverse = abs(X) // D + 1 abs(X) // D + 1 num_reverse K, D = map(int, input().split()) map(int, input().split()) K ans = abs(X) - (num_reverse * D) abs(X) - (num_reverse * D) ans X, K, D = map(int, input().split()) map(int, input().split()) X K -= num_reverse num_reverse K D = map(int, input().split()) map(int, input().split()) D
from collections import deque

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

# まずは何回目で符号が逆転するかを算出
num_reverse = abs(X) // D + 1
if num_reverse > K:
    print(abs(X) - (K * D))
else:
    K -= num_reverse
    ans = abs(X) - (num_reverse * D)
    if K % 2 == 0:
        print(abs(ans))
    else:
        print(abs(abs(ans) - D))


