# -*- coding: utf-8 -*- L, K = map(int, raw_input().split()) print (L - 1) / (K * 2) * K