program sample
	implicit none
    integer(16) :: A,B,C,K,i,D,E,F,count,count1
    
    read(*,*) A,B,C,K
    
    !countでA,B,Cをそれぞれ何回足すかがわかる。(count回足す)
    count = (K+1)/2
    count1 = K/2
    
    if (K==0) then
    	write(*,*) A-B
    else if(A==B) then
    	write(*,*) 0
    else if (count == count1) then
		write(*,*) A-B
    else
    	write(*,*) B-A
        
	end if
     
    stop
end program sample