N = int(input()) M = int(input()) print( N // M // 1000 * 1000 if N >= M * 1000 else 0)