import java.util.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); ArrayList> counts = new ArrayList<>(); HashMap total = new HashMap<>(); for (int i = 0; i < 26; i++) { counts.add(new HashMap<>()); } for (char c : sc.next().toCharArray()) { int idx = c - 'a'; for (int x : counts.get(idx).keySet()) { total.put(x, (total.get(x) - counts.get(idx).get(x) + MOD) % MOD); counts.get(idx).put(x, counts.get(idx).get(x) * 2 % MOD); } counts.get(idx).put(1, counts.get(idx).getOrDefault(1, 0) + 1); for (int x : total.keySet()) { counts.get(idx).put(x + 1, (counts.get(idx).getOrDefault(x + 1, 0) + total.get(x)) % MOD); } for (int x : counts.get(idx).keySet()) { total.put(x, total.getOrDefault(x, 0) + counts.get(idx).get(x)); } } long ans = 0; for (Map.Entry entry : total.entrySet()) { ans += (long)(entry.getKey().intValue()) * entry.getValue() % MOD; ans %= MOD; } System.out.println(ans); } }