import 'dart:io';

void main() {
  List xkd = stdin.readLineSync().split(" ").map((x) => int.parse(x)).toList();
  List list;
  list = [];

  if (xkd[0] <= 0) {
    for (int a = 0; a <= xkd[1]; a++) {
      int add = xkd[2] * (xkd[1] - 2 * a);
      if (add < 0) continue;
      int ans0 = xkd[0] + add;

      list.add(ans0.abs());
    }
  }

  if (xkd[0] > 0) {
    for (int a = 0; a <= xkd[1]; a++) {
      int add = xkd[2] * (xkd[1] - 2 * a);

      if (add > 0) continue;

      int ans0 = xkd[0] + add;

      list.add(ans0.abs());
    }
  }
  List ans = list..sort((a, b) => a.compareTo(b));
  print(ans[0]);
}