<?php $n = trim(fgets(STDIN)); $m = trim(fgets(STDIN)); $money = floor($n / ($m * 1000)) * 1000; echo (int)$money."\n";