import 'dart:io';

void main() {
  List xkd = stdin.readLineSync().split(" ").map((x) => int.parse(x)).toList();
  List list;
  list = [];
  int x0 = xkd[0];
  for (int a = 0; a <= xkd[1]; a++) {
    int dis = -(xkd[1] - a) * (xkd[2]) + a * (xkd[2]);
    int ans0 = xkd[0] + dis;
    list.add(ans0.abs());
  }
  List ans = list..sort((a, b) => a.compareTo(b));
  print(ans[0]);
}