X, Y, L = [gets, gets, gets].map(&:to_i) order_count = 0 unless X.zero? div, mod = X.divmod(L) order_count += (div.abs + (mod.zero? ? 1 : 2)) end unless Y.zero? div, mod = Y.divmod(L) order_count += (div.abs + (mod.zero? ? 0 : 1)) end puts order_count