#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int main() {
    
    // 1. 入力情報取得.
    LL N, M;
    cin >> N >> M;
    
    // 2. 1人分の1000円札の枚数は?
    LL count = N / (1000 * M);
    LL ans = count * 1000;
    
    // 3. 後処理.
    cout << ans << endl;
    return 0;
    
}