#!/usr/bin/perl use strict; use warnings; my $x = <>; my $y = <>; my $l = <>; my $ans = 0; if($x < 0) { $x *= -1; $ans++; } elsif($x > 0) { $ans++; } if($y < 0) { $y *= -1; $ans++; } if($x % $l == 0) { $x = $x / $l; } else { $x = $x / $l; $x = int $x; $x++; } if($y % $l == 0) { $y = $y / $l; } else { $y = $y / $l; $y = int $y; $y++; } print "$x, $y, $ans\n"; $ans += $x + $y; print "$ans\n"; exit;