root = input() num = 1 for d in range(len(root)): if root[0] == "L": num = (2 **(d + 1) - 1) + (num - 2**d) * 2 + 1 else: num = (2 **(d + 1) - 1) + (num - 2**d) * 2 + 2 root = root[1:] print(num)