program sample
    implicit none
    real(8)::x,y,z
    integer(8) :: a,b,c,i,j,m,n,k,a1,b1,c1
    
    
  
    read(*,*) a,b,c,k
    if (mod(k,2)==0)then
        write(*,*) a-b
    else 
        write(*,*) b-a
    end if
    stop
end program sample
  

