This ungainly but grammatical 41-word sentence was constructed by Anton Pavlis of Guelph (Ontario, Canda) in 1983:

So many more men seem to say that they may soon try to stay at home so as to see or hear the same one man try to meet the team on the moon as he has at the other ten tests.

It's an alphametic: if each letter is replaced with a digit (EOMSYHNART = 0123456789), then you get a valid addition:

   SO    31
 MANY  2764
 MORE  2180
  MEN   206
 SEEM  3002
   TO    91
  SAY   374
 THAT  9579
 THEY  9504
  MAY   274
 SOON  3116
  TRY   984
   TO    91
 STAY  3974
   AT    79
 HOME  5120
   SO    31
   AS    73
   TO    91
  SEE   300
   OR    18
 HEAR  5078
  THE   950
 SAME  3720
  ONE   160
  MAN   276
  TRY   984
   TO    91
 MEET  2009
  THE   950
 TEAM  9072
   ON    16
  THE   950
 MOON  2116
   AS    73
   HE    50
  HAS   573
   AT    79
  THE   950
OTHER 19508
  TEN   906
===== =====
TESTS 90393

Input

The first line contains 10 letters. The second line contains a number $$t \in \mathbb{N}_0$$. This is followed by another $$t$$ lines, each containing a word that is composed of the ten letters from the first line of the input.

Output

The ten letters on the first line of the input correspond to the digits 0123456789. They are used to convert words composed of these letters into positive integers. This is done without making a distinction between uppercase and lowercase letters. This conversion can also be done in the opposite direction, where positive integers are converted into words.

For each word from the third line in the input onward, output a line containing the word in capital letters, followed by a space and in between round brackets the positive integer corresponding to the word.

This is followed by a separator line that consists of 10 equal signs (=).

Then follows a last line with the sum $$s$$ of all integers corresponding to the words from the third line of the input onward, and the word (in uppercase) that corresponds to the sum $$s$$. This line uses the same format as the lines above the separator line: first the word, followed by a space and then in between round brackets the integer.

Example

Input:

RSANPULTOE
4
Saturn
Uranus
Neptune
Pluto

Output:

SATURN (127503)
URANUS (502351)
NEPTUNE (3947539)
PLUTO (46578)
==========
PLANETS (4623971)