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

    # Xは0以上と仮定する
    X = X if X >= 0 else -X

    if X - (K * D) >= 0:
        print(X - K * D)
        return

    # 以下は X < K * D
    K -= X // D
    X %= D

    if K % 2 == 0:
        print(X)
    else:
        print(min(abs(X+D), abs(X-D)))

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

    # Xは0以上と仮定する
    X = X if X >= 0 else -X

    if X - (K * D) >= 0:
        print(X - K * D)
        return

    # 以下は X < K * D
    K -= X // D
    X %= D

    if K % 2 == 0:
        print(X)
    else:
        print(min(abs(X+D), abs(X-D))) main X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D X = X if X >= 0 else -X X X if X >= 0 else -X X >= 0 X 0 X -X X if X - (K * D) >= 0:
        print(X - K * D)
        return

    # 以下は X < K * D
     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 return K -= X // D K X // D X D X %= D X D if K % 2 == 0:
        print(X)
    else:
        print(min(abs(X+D), abs(X-D))) K % 2 == 0 K % 2 K 2 0 print(X) print X print(min(abs(X+D), abs(X-D))) print min(abs(X+D), abs(X-D)) min abs(X+D) abs X+D X D abs(X-D) abs X-D X D main() main def main():
    X, K, D = map(int, input().split())

    # Xは0以上と仮定する
    X = X if X >= 0 else -X

    if X - (K * D) >= 0:
        print(X - K * D)
        return

    # 以下は X < K * D
    K -= X // D
    X %= D

    if K % 2 == 0:
        print(X)
    else:
        print(min(abs(X+D), abs(X-D))) def main():
    X, K, D = map(int, input().split())

    # Xは0以上と仮定する
    X = X if X >= 0 else -X

    if X - (K * D) >= 0:
        print(X - K * D)
        return

    # 以下は X < K * D
    K -= X // D
    X %= D

    if K % 2 == 0:
        print(X)
    else:
        print(min(abs(X+D), abs(X-D))) main
def main():
    X, K, D = map(int, input().split())

    # Xは0以上と仮定する
    X = X if X >= 0 else -X

    if X - (K * D) >= 0:
        print(X - K * D)
        return

    # 以下は X < K * D
    K -= X // D
    X %= D

    if K % 2 == 0:
        print(X)
    else:
        print(min(abs(X+D), abs(X-D)))

main()

