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 * reach_or_before #(>0)
    after_dist = D * (reach_or_before + 1) - X
    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 * reach_or_before #(>0)
    after_dist = D * (reach_or_before + 1) - X
    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 * reach_or_before before_dist X - D * reach_or_before X D * reach_or_before D reach_or_before after_dist = D * (reach_or_before + 1) - X after_dist D * (reach_or_before + 1) - X D * (reach_or_before + 1) D reach_or_before + 1 reach_or_before 1 X 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 K, D = map(int, input().split()) map(int, input().split()) K before_dist = X - D * reach_or_before X - D * reach_or_before before_dist X = abs(X) abs(X) X after_dist = D * (reach_or_before + 1) - X D * (reach_or_before + 1) - X after_dist X, K, D = map(int, input().split()) map(int, input().split()) X D = map(int, input().split()) map(int, input().split()) D reach_or_before = X // D X // D reach_or_before remain = K - reach_or_before K - reach_or_before remain
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 * reach_or_before #(>0)
    after_dist = D * (reach_or_before + 1) - X
    if remain % 2 == 0:
        print(before_dist)
    else:
        print(after_dist)
