from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()



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

if X<0:
    X*=-1


k=X//D
if k>=K:
    print(X-K*D)
else:
    K-=k
    if K%2:
        print(-(X-(k+1)*D))
    else:
        print(X-k*D) from heapq import * import sys sys from collections import * from itertools import * from decimal import * import copy copy from bisect import * import math math sys.setrecursionlimit(4100000) sys.setrecursionlimit sys setrecursionlimit 4100000 def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b)) gcd if(a%b==0):return(b)
     a%b==0 a%b a b 0 return (gcd(b,a%b)) gcd(b,a%b) gcd b a%b a b a a b b input=lambda :sys.stdin.readline().rstrip() input lambda :sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip X,K,D=map(int,input().split()) X map(int,input().split()) map int input().split() ().split () input split K D if X<0:
    X*=-1 X<0 X 0 X*=-1 X -1 k=X//D k X//D X D if k>=K:
    print(X-K*D)
else:
    K-=k
    if K%2:
        print(-(X-(k+1)*D))
    else:
        print(X-k*D) k>=K k K print(X-K*D) print X-K*D X K*D K D K-=k K k if K%2:
        print(-(X-(k+1)*D))
    else:
        print(X-k*D) K%2 K 2 print(-(X-(k+1)*D)) print -(X-(k+1)*D) X-(k+1)*D X (k+1)*D k+1 k 1 D print(X-k*D) print X-k*D X k*D k D X,K,D=map(int,input().split()) map(int,input().split()) X k=X//D X//D k X*=-1 -1 X K-=k k K def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b)) def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b)) gcd input=lambda :sys.stdin.readline().rstrip() lambda :sys.stdin.readline().rstrip() input D=map(int,input().split()) map(int,input().split()) D K,D=map(int,input().split()) map(int,input().split()) K
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()



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

if X<0:
    X*=-1


k=X//D
if k>=K:
    print(X-K*D)
else:
    K-=k
    if K%2:
        print(-(X-(k+1)*D))
    else:
        print(X-k*D)
