#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define precise(i) fixed << setprecision(i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
  fastIO;
  unsigned long long int N, M;
  cin >> N >> M;

  if (N >= M * 1000) {
    cout << (N / 1000) / M * 1000 << '\n';
  } else {
    cout << 0 << '\n';
  }
}