408705: GYM103269 B Abhilash's Cat

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Abhilash's Cattime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Abhilash got a cat, but he hasn't decided what to name it yet. He's been deciding between various names, and is struggling to pick one that would be perfect for his pet. As such, he decides to come up with a scoring system.

Every letter in the name is given a value, with "a" having a value of 1, "b" having a value of 2, and so on and so forth, until finally we have "z" having a value of 26. Abhilash has decided that he will take the name with the largest product of the values of its letters, mod $$$10^9 + 7$$$, which is a very large prime. Taking something mod $$$10^9 + 7$$$ means that you need to only output the remainder when dividing by $$$10^9 + 7$$$. However, as he is very poor at math, he wants you to help him write a program to determine the scores of names!

Input

The input will be one line of lower case characters with no spaces of length $$$n (1 \le n \le 10^3)$$$.

Output

A single integer, the score of the given name.

ExampleInput
catluri
Output
2449440
Note

For the sample input, we have "c" as the 3rd letter of the alphabet, "a" as the 1st, and so on and so forth. Multiplying these all together, we get $$$3 \cdot 1 \cdot 20 \cdot 12 \cdot 21 \cdot 18 \cdot 9 \pmod{10^9 + 7} = 2449440$$$.

加入题单

上一题 下一题 算法标签: