x = gets.to_i y = gets.to_i l = gets.to_i rot = x == 0 ? 0 : 1 puts (y < 0 ? 2 : rot) + (x.abs + l - 1) / l + (y.abs + l - 1) / l