import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


X, K, D = MI()

if abs(X) >= K * D:
    print(abs(X) - K * D)
else:
    a = abs(abs(X) - (abs(X) // D) * D)
    K -= (abs(X) // D)
    if K % 2 == 0:
        print(a)
    else:
        print(abs(a - D)) import sys sys sys.setrecursionlimit(300000) sys.setrecursionlimit sys setrecursionlimit 300000 def I(): return int(sys.stdin.readline()) I def MI(): return map(int, sys.stdin.readline().split()) MI def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split()) MI0 def LMI(): return list(map(int, sys.stdin.readline().split())) LMI def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split())) LMI0 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 INF = float('inf') INF float('inf') float 'inf' X, K, D = MI() X MI() MI K D if abs(X) >= K * D:
    print(abs(X) - K * D)
else:
    a = abs(abs(X) - (abs(X) // D) * D)
    K -= (abs(X) // D)
    if K % 2 == 0:
        print(a)
    else:
        print(abs(a - D)) abs(X) >= K * D abs(X) abs X K * D K D print(abs(X) - K * D) print abs(X) - K * D abs(X) abs X K * D K D a = abs(abs(X) - (abs(X) // D) * D) a abs(abs(X) - (abs(X) // D) * D) abs abs(X) - (abs(X) // D) * D abs(X) abs X (abs(X) // D) * D abs(X) // D abs(X) abs X D D K -= (abs(X) // D) K abs(X) // D abs(X) abs X D if K % 2 == 0:
        print(a)
    else:
        print(abs(a - D)) K % 2 == 0 K % 2 K 2 0 print(a) print a print(abs(a - D)) print abs(a - D) abs a - D a D def LMI(): return list(map(int, sys.stdin.readline().split())) def LMI(): return list(map(int, sys.stdin.readline().split())) LMI K -= (abs(X) // D) abs(X) // D K X, K, D = MI() MI() X def MI(): return map(int, sys.stdin.readline().split()) def MI(): return map(int, sys.stdin.readline().split()) MI K, D = MI() MI() K def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split())) def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split())) LMI0 MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split()) def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split()) MI0 a = abs(abs(X) - (abs(X) // D) * D) abs(abs(X) - (abs(X) // D) * D) a D = MI() MI() D INF = float('inf') float('inf') INF
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


X, K, D = MI()

if abs(X) >= K * D:
    print(abs(X) - K * D)
else:
    a = abs(abs(X) - (abs(X) // D) * D)
    K -= (abs(X) // D)
    if K % 2 == 0:
        print(a)
    else:
        print(abs(a - D))