def get_next_num(num, dir): if dir == 'L': return num*2 else: return num*2+1 S = input() now = 1 for Si in S: now = get_next_num(now, Si) print(now)