it = lambda: list(map(int, input().strip().split()))

def solve():
    X, K, D = it()
    X = abs(X)
    if X - K * D >= 0:
        return X - K * D
    K = K - X // D
    X = X - X // D * D
    assert K >= 0
    assert X >= 0
    return abs(X) if K % 2 == 0 else abs(X - D)


if __name__ == '__main__':
    ans = solve()
    print(ans) it = lambda: list(map(int, input().strip().split())) it lambda: list(map(int, input().strip().split())) list(map(int, input().strip().split())) list map(int, input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split def solve():
    X, K, D = it()
    X = abs(X)
    if X - K * D >= 0:
        return X - K * D
    K = K - X // D
    X = X - X // D * D
    assert K >= 0
    assert X >= 0
    return abs(X) if K % 2 == 0 else abs(X - D) solve X, K, D = it() X it() it K D X = abs(X) X abs(X) abs X if X - K * D >= 0:
        return X - K * D
     X - K * D >= 0 X - K * D X K * D K D 0 return X - K * D X - K * D X K * D K D K = K - X // D K K - X // D K X // D X D X = X - X // D * D X X - X // D * D X X // D * D X // D X D D assert K >= 0 K >= 0 K 0 assert X >= 0 X >= 0 X 0 return abs(X) if K % 2 == 0 else abs(X - D) abs(X) if K % 2 == 0 else abs(X - D) K % 2 == 0 K % 2 K 2 0 abs(X) abs X abs(X - D) abs X - D X D if __name__ == '__main__':
    ans = solve()
    print(ans) __name__ == '__main__' __name__ '__main__' ans = solve() ans solve() solve print(ans) print ans ans = solve() solve() ans it = lambda: list(map(int, input().strip().split())) lambda: list(map(int, input().strip().split())) it def solve():
    X, K, D = it()
    X = abs(X)
    if X - K * D >= 0:
        return X - K * D
    K = K - X // D
    X = X - X // D * D
    assert K >= 0
    assert X >= 0
    return abs(X) if K % 2 == 0 else abs(X - D) def solve():
    X, K, D = it()
    X = abs(X)
    if X - K * D >= 0:
        return X - K * D
    K = K - X // D
    X = X - X // D * D
    assert K >= 0
    assert X >= 0
    return abs(X) if K % 2 == 0 else abs(X - D) solve
it = lambda: list(map(int, input().strip().split()))

def solve():
    X, K, D = it()
    X = abs(X)
    if X - K * D >= 0:
        return X - K * D
    K = K - X // D
    X = X - X // D * D
    assert K >= 0
    assert X >= 0
    return abs(X) if K % 2 == 0 else abs(X - D)


if __name__ == '__main__':
    ans = solve()
    print(ans)