# -*- coding: utf-8 -*- N = input() M = input() MAI = N // 1000 print MAI // M * 1000