solve lr = foldr f 1 (reverse lr) where f x y = if x == 'L' then y * 2 else y * 2 + 1 main = getLine >>= print . solve