import Control.Applicative

fairness :: Int -> Int -> Int -> Int
fairness k a b = (fairness_sign k) * (a - b)
    where
        fairness_sign n = if n `mod` 2 == 0 then 1 else -1

main :: IO ()
main = do
    [a, b, c, k] <- map read . words <$> getLine
    putStrLn $ show $ fairness k a b
