def pm(x):
  if x>=0:
    return 1
  else:
    return -1
X,K,D=map(int,input().split())
if (abs(X))<D :
  if K%2==0:
    print(int(abs(X)))
  else:
    a=X-pm(X)*D
    print(int(abs(a)))
else:
  if abs(X)//D>=K:
    a=X-(pm(X))*D*K
    print(int(abs(a)))
  else:
    K=K-int(abs(X)//D)
    X=X-(pm(X))*D*int(abs(X)//D)
    if (abs(X))<D :
      if K%2==0:
        print(int(abs(X)))
      else:
        a=X-(pm(X))*D
        print(int(abs(a))) def pm(x):
  if x>=0:
    return 1
  else:
    return -1 pm if x>=0:
    return 1
  else:
    return -1 x>=0 x 0 return 1 1 return -1 -1 x x X,K,D=map(int,input().split()) X map(int,input().split()) map int input().split() ().split () input split K D if (abs(X))<D :
  if K%2==0:
    print(int(abs(X)))
  else:
    a=X-pm(X)*D
    print(int(abs(a)))
else:
  if abs(X)//D>=K:
    a=X-(pm(X))*D*K
    print(int(abs(a)))
  else:
    K=K-int(abs(X)//D)
    X=X-(pm(X))*D*int(abs(X)//D)
    if (abs(X))<D :
      if K%2==0:
        print(int(abs(X)))
      else:
        a=X-(pm(X))*D
        print(int(abs(a))) (abs(X))<D abs(X) abs X D if K%2==0:
    print(int(abs(X)))
  else:
    a=X-pm(X)*D
    print(int(abs(a))) K%2==0 K%2 K 2 0 print(int(abs(X))) print int(abs(X)) int abs(X) abs X a=X-pm(X)*D a X-pm(X)*D X pm(X)*D pm(X) pm X D print(int(abs(a))) print int(abs(a)) int abs(a) abs a if abs(X)//D>=K:
    a=X-(pm(X))*D*K
    print(int(abs(a)))
  else:
    K=K-int(abs(X)//D)
    X=X-(pm(X))*D*int(abs(X)//D)
    if (abs(X))<D :
      if K%2==0:
        print(int(abs(X)))
      else:
        a=X-(pm(X))*D
        print(int(abs(a))) abs(X)//D>=K abs(X)//D abs(X) abs X D K a=X-(pm(X))*D*K a X-(pm(X))*D*K X (pm(X))*D*K (pm(X))*D pm(X) pm X D K print(int(abs(a))) print int(abs(a)) int abs(a) abs a K=K-int(abs(X)//D) K K-int(abs(X)//D) K int(abs(X)//D) int abs(X)//D abs(X) abs X D X=X-(pm(X))*D*int(abs(X)//D) X X-(pm(X))*D*int(abs(X)//D) X (pm(X))*D*int(abs(X)//D) (pm(X))*D pm(X) pm X D int(abs(X)//D) int abs(X)//D abs(X) abs X D if (abs(X))<D :
      if K%2==0:
        print(int(abs(X)))
      else:
        a=X-(pm(X))*D
        print(int(abs(a))) (abs(X))<D abs(X) abs X D if K%2==0:
        print(int(abs(X)))
      else:
        a=X-(pm(X))*D
        print(int(abs(a))) K%2==0 K%2 K 2 0 print(int(abs(X))) print int(abs(X)) int abs(X) abs X a=X-(pm(X))*D a X-(pm(X))*D X (pm(X))*D pm(X) pm X D print(int(abs(a))) print int(abs(a)) int abs(a) abs a X=X-(pm(X))*D*int(abs(X)//D) X-(pm(X))*D*int(abs(X)//D) X a=X-pm(X)*D X-pm(X)*D a a=X-(pm(X))*D X-(pm(X))*D a K,D=map(int,input().split()) map(int,input().split()) K D=map(int,input().split()) map(int,input().split()) D X,K,D=map(int,input().split()) map(int,input().split()) X a=X-(pm(X))*D*K X-(pm(X))*D*K a def pm(x):
  if x>=0:
    return 1
  else:
    return -1 def pm(x):
  if x>=0:
    return 1
  else:
    return -1 pm K=K-int(abs(X)//D) K-int(abs(X)//D) K
def pm(x):
  if x>=0:
    return 1
  else:
    return -1
X,K,D=map(int,input().split())
if (abs(X))<D :
  if K%2==0:
    print(int(abs(X)))
  else:
    a=X-pm(X)*D
    print(int(abs(a)))
else:
  if abs(X)//D>=K:
    a=X-(pm(X))*D*K
    print(int(abs(a)))
  else:
    K=K-int(abs(X)//D)
    X=X-(pm(X))*D*int(abs(X)//D)
    if (abs(X))<D :
      if K%2==0:
        print(int(abs(X)))
      else:
        a=X-(pm(X))*D
        print(int(abs(a)))