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

X = abs(X)
reach_or_before = X // D


if K <= reach_or_before:
    print(X - D * K)
else:
    #remaining jump
    remain = K - reach_or_before
    before_dist = X % D #(>0)
    after_dist = D - before_dist
    if remain % 2 == 0:
        print(before_dist)
    else:
        print(after_dist) X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D X = abs(X) X abs(X) abs X reach_or_before = X // D reach_or_before X // D X D if K <= reach_or_before:
    print(X - D * K)
else:
    #remaining jump
    remain = K - reach_or_before
    before_dist = X % D #(>0)
    after_dist = D - before_dist
    if remain % 2 == 0:
        print(before_dist)
    else:
        print(after_dist) K <= reach_or_before K reach_or_before print(X - D * K) print X - D * K X D * K D K remain = K - reach_or_before remain K - reach_or_before K reach_or_before before_dist = X % D before_dist X % D X D after_dist = D - before_dist after_dist D - before_dist D before_dist if remain % 2 == 0:
        print(before_dist)
    else:
        print(after_dist) remain % 2 == 0 remain % 2 remain 2 0 print(before_dist) print before_dist print(after_dist) print after_dist D = map(int, input().split()) map(int, input().split()) D X, K, D = map(int, input().split()) map(int, input().split()) X reach_or_before = X // D X // D reach_or_before X = abs(X) abs(X) X after_dist = D - before_dist D - before_dist after_dist remain = K - reach_or_before K - reach_or_before remain K, D = map(int, input().split()) map(int, input().split()) K before_dist = X % D X % D before_dist
X, K, D = map(int, input().split())

X = abs(X)
reach_or_before = X // D


if K <= reach_or_before:
    print(X - D * K)
else:
    #remaining jump
    remain = K - reach_or_before
    before_dist = X % D #(>0)
    after_dist = D - before_dist
    if remain % 2 == 0:
        print(before_dist)
    else:
        print(after_dist)
