Morse Code Generation 

In determining the speed of transmission of messages in Morse code, the controlling element is the dot, `.'. The dash, `-', is three dots in length. Within a character the space between sounds (intra-character space) is considered to be at least a dot in length. The inter-character space is at least a dash in length and the interword space is three dashes in length. It is assumed that each word is five characters in length.


For transmission speeds below thirteen (13) words-per-minute, the individual characters are formed using the dot length of thirteen words per minute, with the extra time placed on the intra-character spaces. Then the inter-character space is three times the intra-character space, and the interword space is three times the inter-character space. Thus at 6.5 words per minute, the inter-character space is twice that of a 13 wpm transmission.


Above 13 wpm, both the character time and the intra-character spacing are controlled by the speed.


For the purpose of this problem assume that the average character is eight (8) dots in length. Thus for a standard of 13 wpm transmission there would be 13*5=65 characters per minute or 65*8=520 dot spaces per minute (and 520 intra-character spaces per minute). You are to use this value for the basis of your program.

Input 

A file consisting of:

Output 

A copy of the message to be sent, one character (an upper case letter or a number) per line followed by a listing, as integers of the number of milliseconds the transmitter will be on and the number of milliseconds the transmitter will be off to result in the desired speed. Each time is to be preceeded and followed by a white space. Sound times will be followed by a single character `S' and no sound times will be followed by a single character `N'. The required inter-character spacing will be the last entry in a line. Each line will be terminated by a new line character.

A blank line separates the output of two messages


Complete set of characters: Below is a table of the characters which can be used for testing and their Morse Code representation.

A  .-           J  .---         S  ...          1  .----
B  -...         K  -.-          T  -            2  ..---
C  -.-.         L  .-..         U  ..-          3  ...--
D  -..          M  --           V  ...-         4  ....-
E  .            N  -.           W  .--          5  .....
F  ..-.         O  ---          X  -..-         6  -....
G  --.          P  .--.         Y  -.--         7  --...
H  ....         Q  --.-         Z  --..         8  ---..
I  ..           R  .-.          0  -----        9  ----.

Sample Input 

A  .-
B  -...
D  -..
G  --.
O  ---
Y  -.--
@
5
A BAD BOY
@
13
A good
boy

Sample output 

A 115 S 300 N 346 S 300 N 900 N
  2700 N
B 346 S 300 N 115 S 300 N 115 S 300 N 115 S 300 N 900 N
A 115 S 300 N 346 S 300 N 900 N
D 346 S 300 N 115 S 300 N 115 S 300 N 900 N
  2700 N
B 346 S 300 N 115 S 300 N 115 S 300 N 115 S 300 N 900 N
O 346 S 300 N 346 S 300 N 346 S 300 N 900 N
Y 346 S 300 N 115 S 300 N 346 S 300 N 346 S 300 N 900 N

A 115 S 115 N 346 S 115 N 346 N
  1038 N
G 346 S 115 N 346 S 115 N 115 S 115 N 346 N
O 346 S 115 N 346 S 115 N 346 S 115 N 346 N
O 346 S 115 N 346 S 115 N 346 S 115 N 346 N
D 346 S 115 N 115 S 115 N 115 S 115 N 346 N
  1038 N
B 346 S 115 N 115 S 115 N 115 S 115 N 115 S 115 N 346 N
O 346 S 115 N 346 S 115 N 346 S 115 N 346 N
Y 346 S 115 N 115 S 115 N 346 S 115 N 346 S 115 N 346 N



Miguel Revilla
2000-09-04