import Control.Applicative import Control.Monad import Data.List f n 'L' = 2 * n f n 'R' = 2 * n + 1 main = getLine >>= print . foldl f 1