input_lines = gets.chop.split.map(&:to_i)
input_lines2 = gets.chop.split("").map(&:to_s)

n = input_lines[0]
count = 1
isWhite = false
isBlack = false
breakRow = 0
multiplication = 0

for i in  0...n
    if input_lines2[i] == input_lines2[(input_lines2.size - 1- i)]
        if input_lines2[i] == "B" &&  i%2 == 0
            isBlack = true
            multiplication = input_lines2.size - (i+1)*2  
        elsif input_lines2[i] == "W" &&  i%2 == 1
            isWhite = true
            multiplication = input_lines2.size - (i+1)*2  
        end
        if  multiplication != 0 
            count *= multiplication
        end
    else 
        breakRow = (n-i)*2 - 1
        if  breakRow != 0 
            count *=  breakRow
        end
        break
    end
end



if isWhite && isBlack
    puts count*n%(10**9+7)
else 
    puts 0
end