V_AYP1_C - Iridium

no tags 

A group of programmers from Iridium develops a multiplatform communications equipment that will connect various offices of the Company for which they work. They want to calculate the time (in ms) that a packet of information will need to travel from origin to destiny through their network, given the size in Bytes of the packet and the means through which it will travel.

The network that interconnects the company is comprised of three different technologies. The first is optic fiber (propagation speed: 0.0769 ms/m), Satellite link (0.033 ms/m) and copper wire (0.0109 ms/m). These values were estimated from the specifications of the hardware that comprises this system and are considered correct. To represent each kind of connection a character will be used: Fiber optic (F), Satellite (S) and Copper wire (T). The bandwidths of the links vary through the system. It is necessary to calculate the time 1 bit will need for it to be transmitted through the links to its destiny.

After calculating the propagation time of 1 bit, according to the data introduced by the user of each link, it will be necessary to calculate the propagation time of all the packet. As it is well known 1 Byte = 8 bits, giving us the option of transforming the packet size given in Bytes to bits and multiplying the propagation time by that amount of bits.

The program must be able to calculate several times, as the studies for the system may be many.

Input details:

The first line of each test case will contain an integer K, which will represent the size in bytes of each packet that will be sent through the link. An undetermined amount of lines will follow, each containing a single string (no spaces), formed by a character C and the distance D in meters of that link. Stopping the input of such lines when C acquires the value ‘*’. The program ends when K=0.

Output details:

For each test case the output will be the time in ms (milliseconds) taken for the transmission of each packet.

 

INPUT

OUTPUT

100

F30

S10

T5

*

0

2153.2

 

Constraints:

0≤ K<100000000

C = {‘F’, ‘S’, ‘T’, ‘*’}

0<D<100000000 



Added by:Venezuelan Programming League
Date:2013-02-02
Time limit:15s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64