#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
from bisect import bisect_left
from itertools import product
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def LF(): return list(map(float, input().split()))
def LC(): return [c for c in input().split()]
def LLI(n): return [LI() for _ in range(n)]
def NSTR(n): return [input() for _ in range(n)]

def array2d(N, M, initial=0):
    return [[initial]*M for _ in range(N)]

def copy2d(orig, N, M):
    ret = array2d(N, M)
    for i in range(N):
        for j in range(M):
            ret[i][j] = orig[i][j]
    return ret


INF = float("inf")
MOD = 10**9 + 7


def main():
    X, K, D = MAP()

    # 到達候補は0に近い正と負の二つの数
    d, m = divmod(X, D)
    cand = (m, m-D)

    if X >= 0:
        if K <= d:
            print(X-K*D)
            return
        else:
            rest = (K-d)
            if rest % 2 == 0:
                print(cand[0])
                return
            else:
                print(-cand[1])
                return
    else:
        if K <= -d-1:
            print(abs(X+K*D))
            return
        else:
            rest = K-(-d-1)
            if rest % 2 == 0:
                print(-cand[1])
                return
            else:
                print(cand[0])
                return
    return


if __name__ == '__main__':
    main() import sys sys sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 from bisect import bisect_left from itertools import product def input(): return sys.stdin.readline().strip() input def INT(): return int(input()) INT def MAP(): return map(int, input().split()) MAP def LI(): return list(map(int, input().split())) LI def LI_(): return list(map(lambda x: int(x)-1, input().split())) LI_ def LF(): return list(map(float, input().split())) LF c for c in input().split() for c in input().split() c input().split() ().split () input split for c in input().split() c def LC(): return [c for c in input().split()] LC LI() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) LI() LI def LLI(n): return [LI() for _ in range(n)] LLI n n input() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) input() input def NSTR(n): return [input() for _ in range(n)] NSTR n n def array2d(N, M, initial=0):
    return [[initial]*M for _ in range(N)] array2d [initial]*M for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) [initial]*M [initial] initial M return [[initial]*M for _ in range(N)] [[initial]*M for _ in range(N)] N N M M initial=0 initial 0 def copy2d(orig, N, M):
    ret = array2d(N, M)
    for i in range(N):
        for j in range(M):
            ret[i][j] = orig[i][j]
    return ret copy2d ret = array2d(N, M) ret array2d(N, M) array2d N M for i in range(N):
        for j in range(M):
            ret[i][j] = orig[i][j]
     i range(N) range N for j in range(M):
            ret[i][j] = orig[i][j]
     j range(M) range M ret[i][j] = orig[i][j] ret[i][j] [i] ret i j orig[i][j] [i] orig i j return ret ret orig orig N N M M INF = float("inf") INF float("inf") float "inf" MOD = 10**9 + 7 MOD 10**9 + 7 10**9 10 9 7 def main():
    X, K, D = MAP()

    # 到達候補は0に近い正と負の二つの数
    d, m = divmod(X, D)
    cand = (m, m-D)

    if X >= 0:
        if K <= d:
            print(X-K*D)
            return
        else:
            rest = (K-d)
            if rest % 2 == 0:
                print(cand[0])
                return
            else:
                print(-cand[1])
                return
    else:
        if K <= -d-1:
            print(abs(X+K*D))
            return
        else:
            rest = K-(-d-1)
            if rest % 2 == 0:
                print(-cand[1])
                return
            else:
                print(cand[0])
                return
    return main X, K, D = MAP() X MAP() MAP K D d, m = divmod(X, D) d divmod(X, D) divmod X D m cand = (m, m-D) cand (m, m-D) m m-D m D if X >= 0:
        if K <= d:
            print(X-K*D)
            return
        else:
            rest = (K-d)
            if rest % 2 == 0:
                print(cand[0])
                return
            else:
                print(-cand[1])
                return
    else:
        if K <= -d-1:
            print(abs(X+K*D))
            return
        else:
            rest = K-(-d-1)
            if rest % 2 == 0:
                print(-cand[1])
                return
            else:
                print(cand[0])
                return
     X >= 0 X 0 if K <= d:
            print(X-K*D)
            return
        else:
            rest = (K-d)
            if rest % 2 == 0:
                print(cand[0])
                return
            else:
                print(-cand[1])
                return
     K <= d K d print(X-K*D) print X-K*D X K*D K D return rest = (K-d) rest K-d K d if rest % 2 == 0:
                print(cand[0])
                return
            else:
                print(-cand[1])
                return
     rest % 2 == 0 rest % 2 rest 2 0 print(cand[0]) print cand[0] cand 0 return print(-cand[1]) print -cand[1] cand[1] cand 1 return if K <= -d-1:
            print(abs(X+K*D))
            return
        else:
            rest = K-(-d-1)
            if rest % 2 == 0:
                print(-cand[1])
                return
            else:
                print(cand[0])
                return
     K <= -d-1 K -d-1 -d d 1 print(abs(X+K*D)) print abs(X+K*D) abs X+K*D X K*D K D return rest = K-(-d-1) rest K-(-d-1) K -d-1 -d d 1 if rest % 2 == 0:
                print(-cand[1])
                return
            else:
                print(cand[0])
                return
     rest % 2 == 0 rest % 2 rest 2 0 print(-cand[1]) print -cand[1] cand[1] cand 1 return print(cand[0]) print cand[0] cand 0 return return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main MOD = 10**9 + 7 10**9 + 7 MOD def LI_(): return list(map(lambda x: int(x)-1, input().split())) def LI_(): return list(map(lambda x: int(x)-1, input().split())) LI_ def LLI(n): return [LI() for _ in range(n)] def LLI(n): return [LI() for _ in range(n)] LLI def INT(): return int(input()) def INT(): return int(input()) INT def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI def LC(): return [c for c in input().split()] def LC(): return [c for c in input().split()] LC def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def LF(): return list(map(float, input().split())) def LF(): return list(map(float, input().split())) LF def NSTR(n): return [input() for _ in range(n)] def NSTR(n): return [input() for _ in range(n)] NSTR def array2d(N, M, initial=0):
    return [[initial]*M for _ in range(N)] def array2d(N, M, initial=0):
    return [[initial]*M for _ in range(N)] array2d def main():
    X, K, D = MAP()

    # 到達候補は0に近い正と負の二つの数
    d, m = divmod(X, D)
    cand = (m, m-D)

    if X >= 0:
        if K <= d:
            print(X-K*D)
            return
        else:
            rest = (K-d)
            if rest % 2 == 0:
                print(cand[0])
                return
            else:
                print(-cand[1])
                return
    else:
        if K <= -d-1:
            print(abs(X+K*D))
            return
        else:
            rest = K-(-d-1)
            if rest % 2 == 0:
                print(-cand[1])
                return
            else:
                print(cand[0])
                return
    return def main():
    X, K, D = MAP()

    # 到達候補は0に近い正と負の二つの数
    d, m = divmod(X, D)
    cand = (m, m-D)

    if X >= 0:
        if K <= d:
            print(X-K*D)
            return
        else:
            rest = (K-d)
            if rest % 2 == 0:
                print(cand[0])
                return
            else:
                print(-cand[1])
                return
    else:
        if K <= -d-1:
            print(abs(X+K*D))
            return
        else:
            rest = K-(-d-1)
            if rest % 2 == 0:
                print(-cand[1])
                return
            else:
                print(cand[0])
                return
    return main INF = float("inf") float("inf") INF def MAP(): return map(int, input().split()) def MAP(): return map(int, input().split()) MAP def copy2d(orig, N, M):
    ret = array2d(N, M)
    for i in range(N):
        for j in range(M):
            ret[i][j] = orig[i][j]
    return ret def copy2d(orig, N, M):
    ret = array2d(N, M)
    for i in range(N):
        for j in range(M):
            ret[i][j] = orig[i][j]
    return ret copy2d
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
from bisect import bisect_left
from itertools import product
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def LF(): return list(map(float, input().split()))
def LC(): return [c for c in input().split()]
def LLI(n): return [LI() for _ in range(n)]
def NSTR(n): return [input() for _ in range(n)]

def array2d(N, M, initial=0):
    return [[initial]*M for _ in range(N)]

def copy2d(orig, N, M):
    ret = array2d(N, M)
    for i in range(N):
        for j in range(M):
            ret[i][j] = orig[i][j]
    return ret


INF = float("inf")
MOD = 10**9 + 7


def main():
    X, K, D = MAP()

    # 到達候補は0に近い正と負の二つの数
    d, m = divmod(X, D)
    cand = (m, m-D)

    if X >= 0:
        if K <= d:
            print(X-K*D)
            return
        else:
            rest = (K-d)
            if rest % 2 == 0:
                print(cand[0])
                return
            else:
                print(-cand[1])
                return
    else:
        if K <= -d-1:
            print(abs(X+K*D))
            return
        else:
            rest = K-(-d-1)
            if rest % 2 == 0:
                print(-cand[1])
                return
            else:
                print(cand[0])
                return
    return


if __name__ == '__main__':
    main()
