main = do
    [a,b,c,n] <- (fmap read) <$> words <$> getLine
    let ans = calc a b c n
    let out = case ans of Just x -> show x
                          Nothing -> "Unfair"
    putStrLn out

calc :: Integer -> Integer -> Integer -> Integer -> Maybe Integer
calc a b c 0 = Just (a-b)
calc a b c n
    | abs(a-b)<=10^18 = calc (b+c) (a+c) (a+b) (n-1)
    | otherwise       = Nothing
