first_place, K, Distance = map(int, input().split())
first_place = abs(first_place)
test = first_place
if first_place - Distance*K > 0:
    print(first_place -Distance*K)
else:
    for i in range(1,K+1):
        test -= Distance
        if test <= 0:
            a = i
            #print(a)
            break
    if (K-a)%2 == 0 or K-a == 0:
        print(abs(first_place - Distance*a))
    else:
        print(abs(first_place - Distance*(a-1))) first_place, K, Distance = map(int, input().split()) first_place map(int, input().split()) map int input().split() ().split () input split K Distance first_place = abs(first_place) first_place abs(first_place) abs first_place test = first_place test first_place if first_place - Distance*K > 0:
    print(first_place -Distance*K)
else:
    for i in range(1,K+1):
        test -= Distance
        if test <= 0:
            a = i
            #print(a)
            break
    if (K-a)%2 == 0 or K-a == 0:
        print(abs(first_place - Distance*a))
    else:
        print(abs(first_place - Distance*(a-1))) first_place - Distance*K > 0 first_place - Distance*K first_place Distance*K Distance K 0 print(first_place -Distance*K) print first_place -Distance*K first_place Distance*K Distance K for i in range(1,K+1):
        test -= Distance
        if test <= 0:
            a = i
            #print(a)
            break
     i range(1,K+1) range 1 K+1 K 1 test -= Distance test Distance if test <= 0:
            a = i
            #print(a)
            break
     test <= 0 test 0 a = i a i break if (K-a)%2 == 0 or K-a == 0:
        print(abs(first_place - Distance*a))
    else:
        print(abs(first_place - Distance*(a-1))) (K-a)%2 == 0 or K-a == 0 (K-a)%2 == 0 (K-a)%2 K-a K a 2 0 K-a == 0 K-a K a 0 print(abs(first_place - Distance*a)) print abs(first_place - Distance*a) abs first_place - Distance*a first_place Distance*a Distance a print(abs(first_place - Distance*(a-1))) print abs(first_place - Distance*(a-1)) abs first_place - Distance*(a-1) first_place Distance*(a-1) Distance a-1 a 1 first_place, K, Distance = map(int, input().split()) map(int, input().split()) first_place K, Distance = map(int, input().split()) map(int, input().split()) K Distance = map(int, input().split()) map(int, input().split()) Distance first_place = abs(first_place) abs(first_place) first_place a = i i a test = first_place first_place test test -= Distance Distance test
first_place, K, Distance = map(int, input().split())
first_place = abs(first_place)
test = first_place
if first_place - Distance*K > 0:
    print(first_place -Distance*K)
else:
    for i in range(1,K+1):
        test -= Distance
        if test <= 0:
            a = i
            #print(a)
            break
    if (K-a)%2 == 0 or K-a == 0:
        print(abs(first_place - Distance*a))
    else:
        print(abs(first_place - Distance*(a-1)))
