The Unit The cows have recently become interested in measurement systems from around the world. They know some conversions between different systems but want your help in determining others. Given a list of the N (1 <= N <= 100) conversions that the cows know (e.g., 12 inches in a foot and 3 feet in a yard), compute the M (1 <= M <= 100) conversions that the cows want to know (e.g., how many inches in a yard?). PROBLEM NAME: unit INPUT FORMAT: * Line 1: Two space-separated integers: N and M. * Lines 2..N+1: Each line is three space-separated fields: a decimal number A followed by two textual names X and Y. Each name will consist of at most 10 lowercase letters. The line indicates that there are A X's in a Y. (For example, the line "12 inch foot" indicates that there are 12 inches in a foot.) * Lines N+2..N+M+1: Each line is two space-separated fields: two textual names X and Y. The cows want to know how many Xs there are in a Y. SAMPLE INPUT: 4 1 12 inch foot 3 foot yard 5280 foot mile 0.0254 meter inch meter mile OUTPUT FORMAT: * Lines 1..M: The Kth line is the answer to the cows' Kth question, multiplied by 1000 and converted to an integer. That integer is guaranteed to be less than 2^31. SAMPLE OUTPUT: 1609344 OUTPUT DETAILS: There are 1609.344 meters in a mile.