import sys readline = sys.stdin.buffer.readline readall = sys.stdin.read ns = lambda: readline().rstrip() ni = lambda: int(readline().rstrip()) nm = lambda: map(int, readline().split()) nl = lambda: list(map(int, readline().split())) prn = lambda x: print(*x, sep='\n') def modinv(x, mod): a, b = x, mod u, v = 1, 0 while b: t = a // b a -= t * b; a, b = b, a u -= t * v; u, v = v, u return u % mod mod = 10**9 + 7 n = 2 * 10 ** 5 + 10 pos = [1] * n neg = [1] * n for i in range(1, n): pos[i] = pos[i-1] * 2 % mod neg[-1] = modinv(pos[-1], mod) for j in range(n-2, -1, -1): neg[j] = neg[j+1] * 2 % mod def solve(): sig = 26 s = [x - 97 for x in list(ns())] n = len(s) cur = 0 g = [list() for _ in range(sig)] for i in range(n): g[s[i]].append(i) for x in range(sig): m = len(g[x]) h = [neg[y] for y in g[x]] for j in range(m-2, -1, -1): h[j] += h[j+1] for i in range(m-1): # print(pow(2, n-1, mod) * pos[g[x][i]] * h[i+1] % mod) cur = (cur + pos[g[x][i]] * h[i+1]) % mod print((n - cur) * pow(2, n-1, mod) % mod) return solve()