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