x,k,d = map(int, input().split())
x = abs(x)
if x - d*k >= 0:
    print(abs(x-d*k))
else:
    a = x // d
    if k % 2 == 0:
        if a % 2 == 0:
            print(abs(x - d*a))
        else:
            print(abs(x - d * (a+1)))
    else:
        if a % 2 == 0:
            print(abs(x - d * (a + 1)))
        else:
            print(abs(x - d * a))
 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 - d*k >= 0:
    print(abs(x-d*k))
else:
    a = x // d
    if k % 2 == 0:
        if a % 2 == 0:
            print(abs(x - d*a))
        else:
            print(abs(x - d * (a+1)))
    else:
        if a % 2 == 0:
            print(abs(x - d * (a + 1)))
        else:
            print(abs(x - d * a)) x - d*k >= 0 x - d*k x d*k d k 0 print(abs(x-d*k)) print abs(x-d*k) abs x-d*k x d*k d k a = x // d a x // d x d if k % 2 == 0:
        if a % 2 == 0:
            print(abs(x - d*a))
        else:
            print(abs(x - d * (a+1)))
    else:
        if a % 2 == 0:
            print(abs(x - d * (a + 1)))
        else:
            print(abs(x - d * a)) k % 2 == 0 k % 2 k 2 0 if a % 2 == 0:
            print(abs(x - d*a))
        else:
            print(abs(x - d * (a+1)))
     a % 2 == 0 a % 2 a 2 0 print(abs(x - d*a)) print abs(x - d*a) abs x - d*a x d*a d a print(abs(x - d * (a+1))) print abs(x - d * (a+1)) abs x - d * (a+1) x d * (a+1) d a+1 a 1 if a % 2 == 0:
            print(abs(x - d * (a + 1)))
        else:
            print(abs(x - d * a)) a % 2 == 0 a % 2 a 2 0 print(abs(x - d * (a + 1))) print abs(x - d * (a + 1)) abs x - d * (a + 1) x d * (a + 1) d a + 1 a 1 print(abs(x - d * a)) print abs(x - d * a) abs x - d * a x d * a d a k,d = map(int, input().split()) map(int, input().split()) k a = x // d x // d a x = abs(x) abs(x) x x,k,d = map(int, input().split()) map(int, input().split()) x d = map(int, input().split()) map(int, input().split()) d
x,k,d = map(int, input().split())
x = abs(x)
if x - d*k >= 0:
    print(abs(x-d*k))
else:
    a = x // d
    if k % 2 == 0:
        if a % 2 == 0:
            print(abs(x - d*a))
        else:
            print(abs(x - d * (a+1)))
    else:
        if a % 2 == 0:
            print(abs(x - d * (a + 1)))
        else:
            print(abs(x - d * a))

