import sys


def input():
    return sys.stdin.readline().rstrip('\n')


def calc(X, K, D):
    X = abs(X)
    n = X // D
    if K <= n:
        return abs(X - K * D)
    if (K - n) % 2 == 0:
        return abs(X - n * D)
    else:
        return abs(X - (n + 1) * D)


(X, K, D) = tuple([int(s) for s in input().split()])
print(calc(X, K, D)) import sys sys def input():
    return sys.stdin.readline().rstrip('\n') input return sys.stdin.readline().rstrip('\n') sys.stdin.readline().rstrip('\n') sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip '\n' def calc(X, K, D):
    X = abs(X)
    n = X // D
    if K <= n:
        return abs(X - K * D)
    if (K - n) % 2 == 0:
        return abs(X - n * D)
    else:
        return abs(X - (n + 1) * D) calc X = abs(X) X abs(X) abs X n = X // D n X // D X D if K <= n:
        return abs(X - K * D)
     K <= n K n return abs(X - K * D) abs(X - K * D) abs X - K * D X K * D K D if (K - n) % 2 == 0:
        return abs(X - n * D)
    else:
        return abs(X - (n + 1) * D) (K - n) % 2 == 0 (K - n) % 2 K - n K n 2 0 return abs(X - n * D) abs(X - n * D) abs X - n * D X n * D n D return abs(X - (n + 1) * D) abs(X - (n + 1) * D) abs X - (n + 1) * D X (n + 1) * D n + 1 n 1 D X X K K D D int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s (X, K, D) = tuple([int(s) for s in input().split()]) (X, K, D) X K D tuple([int(s) for s in input().split()]) tuple [int(s) for s in input().split()] print(calc(X, K, D)) print calc(X, K, D) calc X K D def input():
    return sys.stdin.readline().rstrip('\n') def input():
    return sys.stdin.readline().rstrip('\n') input def calc(X, K, D):
    X = abs(X)
    n = X // D
    if K <= n:
        return abs(X - K * D)
    if (K - n) % 2 == 0:
        return abs(X - n * D)
    else:
        return abs(X - (n + 1) * D) def calc(X, K, D):
    X = abs(X)
    n = X // D
    if K <= n:
        return abs(X - K * D)
    if (K - n) % 2 == 0:
        return abs(X - n * D)
    else:
        return abs(X - (n + 1) * D) calc
import sys


def input():
    return sys.stdin.readline().rstrip('\n')


def calc(X, K, D):
    X = abs(X)
    n = X // D
    if K <= n:
        return abs(X - K * D)
    if (K - n) % 2 == 0:
        return abs(X - n * D)
    else:
        return abs(X - (n + 1) * D)


(X, K, D) = tuple([int(s) for s in input().split()])
print(calc(X, K, D))