import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static double calculateMaxAmount(Map<String, Double> fxRates, String originalCurrency, String targetCurrency) {
if (originalCurrency.equals(targetCurrency)) {
return 1.0;
}
double maxAmount = -1.0;
for (Map.Entry<String, Double> entry : fxRates.entrySet()) {
String[] currencies = entry.getKey().split(",");
String fromCurrency = currencies[0].trim();
String toCurrency = currencies[1].trim();
double rate = entry.getValue();
if (fromCurrency.equals(originalCurrency)) {
double amount = rate * calculateMaxAmount(fxRates, toCurrency, targetCurrency);
if (amount > maxAmount) {
maxAmount = amount;
}
}
}
return maxAmount;
}
public static void main(String[] args) throws IOException {
InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
BufferedReader in = new BufferedReader(reader);
Map<String, Double> exchangeRates = new HashMap<>();
exchangeRates.put("USD, CAD", 1.3);
exchangeRates.put("USD, GBP", 0.71);
exchangeRates.put("USD, JPY", 109.0);
exchangeRates.put("GBP, CAD", 155.0);
String line;
while ((line = in.readLine()) != null) {
String[] input = line.split(",");
if (input.length < 2) {
continue;
}
String originalCurrency = input[0].trim();
String targetCurrency = input[1].trim();
double maxTargetAmount = calculateMaxTargetAmount(exchangeRates, originalCurrency, targetCurrency);
System.out.println(maxTargetAmount);
}
}}