#K80847. Message Code Computation

    ID: 35621 Type: Default 1000ms 256MiB

Message Code Computation

Message Code Computation

You are given a message consisting of lowercase Latin letters. For each distinct character c in the message, let f(c) denote its frequency and \(a(c)\) denote its ASCII value. The special code for the message is defined by the formula:

Code = \(\sum_{c \in S} f(c) \times a(c)\)

Your task is to compute this code for each message provided.

inputFormat

The first line contains an integer T (\(1 \le T \le 10^5\)) representing the number of test cases.

Each of the following T lines contains a single string composed of lowercase Latin letters. The string may be empty.

outputFormat

For each test case, output the computed code on a separate line.

## sample
2
abc
aabbcc
294

588

</p>