N = int(raw_input()) M = int(raw_input()) assert 1 <= N <= 10 ** 16 assert 1 <= M <= 10 ** 16 A = (N // 1000) / M print A * 1000