n = int(eval(input()))

s = eval(input())

mod = 10**9 + 7



ans = 0

cnt = [1] * 26

for i,ch in enumerate(s):

    tmp = 1

    for j in range(26):

        if(j==(ord(ch) - 97)):

            continue

        tmp *= cnt[j]

        tmp %= mod

    ans += tmp

    ans %= mod

    cnt[ord(ch) - 97] += 1



print(ans)
n = int(eval(input()))

s = eval(input())

mod = 10**9 + 7



cnt = [0] * 26

for i in range(26):

    cnt[i] = s.count(chr(i+97)) + 1



ans = 1

for i in cnt:

    ans *= i

    ans %= mod



ans -= 1

ans %= mod

print(ans)
n = int(eval(input()))
s = eval(input())
mod = 10**9 + 7
ans = 0
cnt = [1] * 26
for i, ch in enumerate(s):
    tmp = 1
    for j in range(26):
        if j == (ord(ch) - 97):
            continue
        tmp *= cnt[j]
        tmp %= mod
    ans += tmp
    ans %= mod
    cnt[ord(ch) - 97] += 1
print(ans)

n = int(eval(input()))
s = eval(input())
mod = 10**9 + 7
cnt = [0] * 26
for i in range(26):
    cnt[i] = s.count(chr(i + 97)) + 1
ans = 1
for i in cnt:
    ans *= i
    ans %= mod
ans -= 1
ans %= mod
print(ans)

-ans = 0 -cnt = [1] * 26 -for i, ch in enumerate(s): -    tmp = 1 -    for j in range(26): -        if j == (ord(ch) - 97): -            continue -        tmp *= cnt[j] -        tmp %= mod -    ans += tmp +cnt = [0] * 26 +for i in range(26): +    cnt[i] = s.count(chr(i + 97)) + 1 +ans = 1 +for i in cnt: +    ans *= i -    cnt[ord(ch) - 97] += 1 +ans -= 1 +ans %= mod