a,b,s=gets.split.map &:to_i p (c=(a-s).abs)>(d=(b-s).abs)&&s>1?d+(a<1?s+1:[c,s-1].min+a):c+s