n = gets.to_i
s = gets.chomp

compressed = []
s.each_char do |c|
  if c == compressed.last&.keys&.first
    compressed.last[c] += 1
  else
    compressed << { c => 1 }
  end
end

count = 0
(1..compressed.size).each do |len|
  if len == 1
    count += n
    next
  end
  compressed.combination(len) do |array|
    keys = array.map {|h| h.keys.first }
    count += compressed.reduce(1) {|res, a| res * a.values.first } if keys.uniq.size == keys.size
  end
end

puts count % 1_000_000_007
