#include #include #include #include #include #include #include #include using namespace std; using ull = unsigned long long; int main() { ull l,k; cin >> l >> k; int num = ceil(l/(2*k)); if(num & 1) cout << (num-1)*k << endl; else cout << num*k << endl; }