using System; using static System.Math; public class Program { public static void Main(string[] args) { var x = int.Parse(Console.ReadLine()); var y = int.Parse(Console.ReadLine()); var step = int.Parse(Console.ReadLine()); int rotCnt; var move_x = Abs((x / step)) + Abs((x % step)); var move_y = Abs((y / step)) + Abs((y % step)); if (x < 0 && y < 0) rotCnt = 2; else if (x < 0 && y > 0) rotCnt = 1; else if (x > 0 && y > 0) rotCnt = 1; else if (x > 0 && y < 0) rotCnt = 2; else if (x == 0 && y < 0) rotCnt = 2; else if (x != 0 && y == 0) rotCnt = 1; else rotCnt = 0; Console.WriteLine(move_x + move_y + rotCnt); } }