Eduardo is planning for a trip to Mexico this summer and he needs to buy some pesos for his trip. Eduardo doesn't trust currency exchange businesses as he believes they give bad rates, so instead he will ask his friends to trade currencies.
Eduardo has
Eduardo currently has
Input Specification
The standard input contains 10 datasets. Each dataset begins with three integers
The next
is the index of the currency that the friend wants. is the index of the currency that the friend has. is the exchange rate that the friend set. The friend will sell unit of currency for units of currency .
For the first four cases, each exchange rate
Output Specification
For each dataset, output the maximum number of pesos that Eduardo can get, rounded to two decimal places. If Eduardo can get more than one billion pesos, output Billionaire!
instead. It is guaranteed that the answer will not be within 1000 pesos of one billion.
Sample Input (Two Datasets Shown)
3 3 3
1 3 1.0000
1 2 2.0000
2 3 0.3000
4 4 1
1 2 0.5000
2 3 0.5000
3 4 0.5000
4 1 7.0000
Sample Output
5.00
Billionaire!
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments