#include using namespace std; int main() { // 入力 int L, K; cin >> L >> K; // 解答 cout << (L - 1) / K / 2 * K << endl; return 0; }