class Calc0104 def initialize(args) args = args.map { |l| l.chomp.split(/\s+/) } @s = args.shift.first || '' end def run c = 1 @s.split(//).each do |b| case b when 'L' c = c * 2 when 'R' c = c * 2 + 1 end end c end end puts Calc0104.new(STDIN.readlines).run if __FILE__ == $0