n = int(input())#予算n円 m = int(input())#m人に同額渡す otoshi = n//(1000*m) print(otoshi*1000)