use strict; use warnings; my($l, $k) = split(' ', ); my $num = int($l/$k*2); if($l%$k*2 == 0){ $num -= 1; } print $num*$k;