import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int l = sc.nextInt(); int k = sc.nextInt(); int ans = 0; while(l > 2 * k) { ans += k; l -= 2 * k; } System.out.println(ans); } }