package yukiCoder; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00063 { public static void main(String[] args) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String[] input = new String[2]; try { input = bufferedReader.readLine().split(" "); long length = Long.parseLong(input[0]); int eat = Integer.parseInt(input[1]); int ans = calculation(length,eat); System.out.println(ans); } catch (IOException e) { e.printStackTrace(); } } public static int calculation(long length, int eat) { int cnt = 0; cnt = (int) (length/(eat*2)); if (length%(eat*2) == 0) { cnt--; } return cnt * eat; } }