def main(): L, K = map(int, input().split()) one_time_eaten_length = 2 * K i = L // one_time_eaten_length if L % one_time_eaten_length == 0: print(K * (i-1)) else: print(K * i) if __name__ == '__main__': main()