#include #include #include using namespace std; using ll = long long; //63 int main() { int L, K, step; scanf("%d %d", &L, &K); step = L / (K * 2); step = step - (L % (K * 2) == 0); printf("%d\n", step * K); }