#include <bits/stdc++.h>
using namespace std;

long long x, k, d, one = 1;

int main() {
  cin >> x >> k >> d;
  if (x < 0) one *= -1, x *= -1;
  long long now = min(x / d, k);
  x -= d * now;
  k -= now;
  k %= 2;
  if (k & 1) x -= d;
  cout << abs(x) << endl;
  return 0;
}