N = int(input())//1000 M = int(input()) print(N//M * 1000)