x, k, d = map(int, input().split())

if x + k * d <= 0:
    print(-(x + k * d))
elif x - k * d >= 0:
    print(x - k * d)
elif x >= 0:
    print(min([abs(x - (k - 2 * i) * d) for i in range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100)]))
else:
    print(min([abs(x + (k - 2 * i) * d) for i in range((k * d + x) // (2 * d) - 100, (k * d + x) // (2 * d) + 100)])) x, k, d = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d if x + k * d <= 0:
    print(-(x + k * d))
elif x - k * d >= 0:
    print(x - k * d)
elif x >= 0:
    print(min([abs(x - (k - 2 * i) * d) for i in range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100)]))
else:
    print(min([abs(x + (k - 2 * i) * d) for i in range((k * d + x) // (2 * d) - 100, (k * d + x) // (2 * d) + 100)])) x + k * d <= 0 x + k * d x k * d k d 0 print(-(x + k * d)) print -(x + k * d) x + k * d x k * d k d elif x - k * d >= 0:
    print(x - k * d) x - k * d >= 0 x - k * d x k * d k d 0 print(x - k * d) print x - k * d x k * d k d elif x >= 0:
    print(min([abs(x - (k - 2 * i) * d) for i in range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100)])) x >= 0 x 0 abs(x - (k - 2 * i) * d) for i in range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100) for i in range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100) i range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100) range (k * d - x) // (2 * d) - 100 (k * d - x) // (2 * d) k * d - x k * d k d x 2 * d 2 d 100 (k * d - x) // (2 * d) + 100 (k * d - x) // (2 * d) k * d - x k * d k d x 2 * d 2 d 100 for i in range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100) abs(x - (k - 2 * i) * d) abs x - (k - 2 * i) * d x (k - 2 * i) * d k - 2 * i k 2 * i 2 i d print(min([abs(x - (k - 2 * i) * d) for i in range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100)])) print min([abs(x - (k - 2 * i) * d) for i in range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100)]) min [abs(x - (k - 2 * i) * d) for i in range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100)] abs(x + (k - 2 * i) * d) for i in range((k * d + x) // (2 * d) - 100, (k * d + x) // (2 * d) + 100) for i in range((k * d + x) // (2 * d) - 100, (k * d + x) // (2 * d) + 100) i range((k * d + x) // (2 * d) - 100, (k * d + x) // (2 * d) + 100) range (k * d + x) // (2 * d) - 100 (k * d + x) // (2 * d) k * d + x k * d k d x 2 * d 2 d 100 (k * d + x) // (2 * d) + 100 (k * d + x) // (2 * d) k * d + x k * d k d x 2 * d 2 d 100 for i in range((k * d + x) // (2 * d) - 100, (k * d + x) // (2 * d) + 100) abs(x + (k - 2 * i) * d) abs x + (k - 2 * i) * d x (k - 2 * i) * d k - 2 * i k 2 * i 2 i d print(min([abs(x + (k - 2 * i) * d) for i in range((k * d + x) // (2 * d) - 100, (k * d + x) // (2 * d) + 100)])) print min([abs(x + (k - 2 * i) * d) for i in range((k * d + x) // (2 * d) - 100, (k * d + x) // (2 * d) + 100)]) min [abs(x + (k - 2 * i) * d) for i in range((k * d + x) // (2 * d) - 100, (k * d + x) // (2 * d) + 100)] d = map(int, input().split()) map(int, input().split()) d k, d = map(int, input().split()) map(int, input().split()) k x, k, d = map(int, input().split()) map(int, input().split()) x
x, k, d = map(int, input().split())

if x + k * d <= 0:
    print(-(x + k * d))
elif x - k * d >= 0:
    print(x - k * d)
elif x >= 0:
    print(min([abs(x - (k - 2 * i) * d) for i in range((k * d - x) // (2 * d) - 100, (k * d - x) // (2 * d) + 100)]))
else:
    print(min([abs(x + (k - 2 * i) * d) for i in range((k * d + x) // (2 * d) - 100, (k * d + x) // (2 * d) + 100)]))
