main = do s <- getLine print $ f 1 s f i [] = i f i (x:xs) | x == 'L' = f (2 * i) xs | otherwise = f (2 * i + 1) xs