#include using namespace std; int main() { int N, M; cin >> N >> M; int yuu = N / (M * 2); if (!(N % (M * 2))) yuu--; cout << max(0, yuu * M) << "\n"; }