import java.util.Scanner; class Test { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int l = in.nextInt(); int k = in.nextInt(); int temp = k * 2; if(l % temp == 0) { System.out.println((l / temp - 1) * k); } else { System.out.println(l / temp * k); } } }