x,y,z=gets.split.map &:to_i x,y=y,x if x>y if y-x>z p x+z else p (z+y+x)/2 end