import std.stdio, std.conv, std.math, std.string, std.range, std.array,
       std.algorithm;

void main(){
  auto buf = readln().strip().split().map!(to!int)();
  immutable L = buf[0];
  immutable K = buf[1];

  writeln(((L-1) / (K*2)) * K);
}