N = int(input()) M = int(input()) print('{}'.format(((N // 1000) // M) * 1000))