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