# -*- coding: utf-8 -*- if __name__ == '__main__': L, K = list(map(int, input().split())) q = int(L / (K * 2)) if q == 1: print(0) else: print(q * K)