import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int L = scan.nextInt(); int K = scan.nextInt(); scan.close(); int k1 = L / (2 * K); int k2 = L % (2 * K); if(k2 == 0) { k1 = k1 - 1; } System.out.println(k1 * K); } }