a, b, c = map(int, input().split())
d = abs(a)
count = min(d//c, b)
d -= c*count
b -= count
if b % 2 == 1:
    d -= c
print(abs(d)) a, b, c = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b c d = abs(a) d abs(a) abs a count = min(d//c, b) count min(d//c, b) min d//c d c b d -= c*count d c*count c count b -= count b count if b % 2 == 1:
    d -= c b % 2 == 1 b % 2 b 2 1 d -= c d c print(abs(d)) print abs(d) abs d b, c = map(int, input().split()) map(int, input().split()) b count = min(d//c, b) min(d//c, b) count b -= count count b d -= c c d a, b, c = map(int, input().split()) map(int, input().split()) a d = abs(a) abs(a) d c = map(int, input().split()) map(int, input().split()) c d -= c*count c*count d
a, b, c = map(int, input().split())
d = abs(a)
count = min(d//c, b)
d -= c*count
b -= count
if b % 2 == 1:
    d -= c
print(abs(d))