import Control.Monad

main = do
    argList <- lines <$> getContents
    let ds = toDoubleList argList
    print $ solve ds 

toDoubleList :: [String] -> [Double]
toDoubleList vals = do
    val <- vals
    let d = read val :: Double
    return d

solve :: [Double] -> Double
solve ds = 2 * target - rate
    where 
        rate = head ds
        target = last ds