eolymp
bolt
Try our new interface for solving problems
Problems

Sort the hashes

Sort the hashes

Time limit 1 second
Memory limit 128 MiB

Set of words is given. Sort them in ascending order of hashes.

The hash of the string s is the sum of the ASCII codes of the characters in it. For example, hash("Cat") = 67 + 97 + 116 = 280, hash("dOG") = 100 + 79 + 71 = 250.

Let a string a be less than a string b if hash(a) < hash(b). For example, hash("dOG") < hash("Cat") since 250 < 280.

However, there is a special word "ADAUniversity" in the text, that should always be at the start of the sorted list. We assume that hash("ADAUniversity") = 0.

For words that have the same hash, their relative order must be preserved (implement a stable sort).

Input data

The text contains a set of words. Each word consists of letters of Latin alphabet (lower and upper case). Only spaces can be present between the words. The number of words in the text does not exceed 1000. The length of each word does not exceed 100 characters.

Output data

Print all words sorted according to the given condition. Each word should be printed on a separate line.

Examples

Input example #1
Cat ADAUniversity
dOG      ADAUniversity
    ABC     Cat
Output example #1
ADAUniversity
ADAUniversity
ABC
dOG
Cat
Cat
Author Michael Medvediev