x,y,d=gets.split.map(&:to_i) ## x inf case and y inf case d+=1 xinfc_h = [d,y+1].min yinfc_h = [d,x+1].min e = xinfc_h-(d-yinfc_h) p [0,e].max