#K85392. ASCII Transformation

    ID: 36631 Type: Default 1000ms 256MiB

ASCII Transformation

ASCII Transformation

Given a string s, compute a transformed integer as follows: for each character in the string, multiply its ASCII value by its position (starting from 1) and sum the results. The final answer is the sum modulo (10^9+7).

For example, for s = 'abc':
(\text{result} = 97 \times 1 + 98 \times 2 + 99 \times 3 = 590).

This problem will test your ability to process strings and perform modular arithmetic.

inputFormat

The first line of input contains an integer (T) representing the number of test cases. Each of the following (T) lines contains a single string (s).

outputFormat

For each test case, output the transformed integer on a new line.## sample

1
abc
590

</p>