import math

def solve(x, k, d):
    x = math.fabs(x)
    if x - k * d >= 0:
        return int(x - k * d)
    else:
        cur = x - x // d * d
        k = k - x // d
        if k % 2 == 0:
            return int(cur)
        else:
            return int(abs(cur - d))

if __name__ == "__main__":
    x, k, d = map(int, input().split(' '))
    print(solve(x, k, d)) import math math def solve(x, k, d):
    x = math.fabs(x)
    if x - k * d >= 0:
        return int(x - k * d)
    else:
        cur = x - x // d * d
        k = k - x // d
        if k % 2 == 0:
            return int(cur)
        else:
            return int(abs(cur - d)) solve x = math.fabs(x) x math.fabs(x) math.fabs math fabs x if x - k * d >= 0:
        return int(x - k * d)
    else:
        cur = x - x // d * d
        k = k - x // d
        if k % 2 == 0:
            return int(cur)
        else:
            return int(abs(cur - d)) x - k * d >= 0 x - k * d x k * d k d 0 return int(x - k * d) int(x - k * d) int x - k * d x k * d k d cur = x - x // d * d cur x - x // d * d x x // d * d x // d x d d k = k - x // d k k - x // d k x // d x d if k % 2 == 0:
            return int(cur)
        else:
            return int(abs(cur - d)) k % 2 == 0 k % 2 k 2 0 return int(cur) int(cur) int cur return int(abs(cur - d)) int(abs(cur - d)) int abs(cur - d) abs cur - d cur d x x k k d d if __name__ == "__main__":
    x, k, d = map(int, input().split(' '))
    print(solve(x, k, d)) __name__ == "__main__" __name__ "__main__" x, k, d = map(int, input().split(' ')) x map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' k d print(solve(x, k, d)) print solve(x, k, d) solve x k d x, k, d = map(int, input().split(' ')) map(int, input().split(' ')) x def solve(x, k, d):
    x = math.fabs(x)
    if x - k * d >= 0:
        return int(x - k * d)
    else:
        cur = x - x // d * d
        k = k - x // d
        if k % 2 == 0:
            return int(cur)
        else:
            return int(abs(cur - d)) def solve(x, k, d):
    x = math.fabs(x)
    if x - k * d >= 0:
        return int(x - k * d)
    else:
        cur = x - x // d * d
        k = k - x // d
        if k % 2 == 0:
            return int(cur)
        else:
            return int(abs(cur - d)) solve d = map(int, input().split(' ')) map(int, input().split(' ')) d k, d = map(int, input().split(' ')) map(int, input().split(' ')) k
import math

def solve(x, k, d):
    x = math.fabs(x)
    if x - k * d >= 0:
        return int(x - k * d)
    else:
        cur = x - x // d * d
        k = k - x // d
        if k % 2 == 0:
            return int(cur)
        else:
            return int(abs(cur - d))

if __name__ == "__main__":
    x, k, d = map(int, input().split(' '))
    print(solve(x, k, d))
