DIV = 1_000_000_007
n = gets.to_i
l = n.times.map{ gets.chomp }
l.delete('-')
s = l.size
u = l.count('U')
d = l.count('D')
pos_u = [0]*s
pos_d = [-d]*s
l.each_with_index do |str, i|
  if str == 'U' then (i+1...s).each{ |j| pos_u[j]+= 1 }
  else               (0...i).each{   |j| pos_d[j]+= 1 }
  end
end
dp = (s+1).times.map{ [0]*(s+1) }
dp[0][0] = 1
for i in (1..s)
  for j in (0..i)
    dp[i][j] = dp[i-1][j-1]*(pos_u[i-1]-(j-1)) if j > 0
    dp[i][j] += dp[i-1][j]*(pos_d[i-1]-(j-i)) if j < i
    dp[i][j] %= DIV
  end
end
p dp[s][u]