program prob2
    implicit none
    integer(16)::A, B, C, K, i, e, f
    read(*,*) A, B, C, K

    if(mod(K,2) == 1)then
        write(*,*) B-A
    else
        write(*,*) A-B
    end if

    stop

end program prob2