import java.util.*; public class Yukicoder_63{ public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); int L = stdIn.nextInt(); int K = stdIn.nextInt(); int count = 0; while(true){ if(L<=2*K){ System.out.println(count*K); break; } L -= 2*K; count++; } } }