my $X = <>; my $Y = <>; my $K = <>; #to make a positive number my $pX = sqrt($X*$X); my $pY = sqrt($Y*$Y); my $remainder_x = $pX % $K; my $count_x = ($pX - $remainder_x)/$K; my $remainder_y = $pY % $K; my $count_y = ($pY - $remainder_y)/$K; my $count; if($remainder_x != 0 && $remainder_y != 0){ $count = 2; }elsif($remainder_x != 0 || $remainder_y != 0){ $count = 1; }else{ $count = 0; } my $turn; if($X == 0 && $Y == 0){ $turn = 0; }elsif($X == 0 && $Y > 0){ $turn = 0; }elsif($Y < 0){ $turn = 2; }else{ $turn = 1; } my $ans = $count + $count_x + $count_y + $turn; print "$ans\n";