import math, strscans

let
  (_, x, y, r) = stdin.readAll.scanTuple"$f $f $f"
  ans = succ toInt floor r / sqrt(2.0) * 2 + x.abs + y.abs

echo ans