import math

X,K,D = map(int,input().split())
X = abs(X)

if X > K*D:
    print(X-K*D)
else:
    c=math.floor(X/D)
    print( abs(X-D*c-((K-c)%2)*D) )
  import math math 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 if X > K*D:
    print(X-K*D)
else:
    c=math.floor(X/D)
    print( abs(X-D*c-((K-c)%2)*D) )
  X > K*D X K*D K D print(X-K*D) print X-K*D X K*D K D c=math.floor(X/D) c math.floor(X/D) math.floor math floor X/D X D print( abs(X-D*c-((K-c)%2)*D) ) print abs(X-D*c-((K-c)%2)*D) abs X-D*c-((K-c)%2)*D X-D*c X D*c D c ((K-c)%2)*D (K-c)%2 K-c K c 2 D K,D = map(int,input().split()) map(int,input().split()) K D = map(int,input().split()) map(int,input().split()) D X = abs(X) abs(X) X c=math.floor(X/D) math.floor(X/D) c X,K,D = map(int,input().split()) map(int,input().split()) X
import math

X,K,D = map(int,input().split())
X = abs(X)

if X > K*D:
    print(X-K*D)
else:
    c=math.floor(X/D)
    print( abs(X-D*c-((K-c)%2)*D) )
 