#OLD144. Time is of the Essence1

Time is of the Essence1

Description

Do you know how long one million seconds is? How about one billion seconds? Well, the answer to the first one is 11 days, 13 hours, 46 minutes and 40 seconds Accurate, but a little over-precise. A more reasonable answer might be 11 days, 14 hours" or just12 days" (after rounding). As another example, if I asked how long three million inches were, you could approximate it by saying either 47 miles" or47 miles, 613 yards". This sort of imprecision is what we're looking for in this problem!

Format

Input

There are multiple test cases. For each case,Input consists of two lines. The first line has the form n name[1] c[1] name[2] c[2] .... name[n-1] c[n-1] name[n] c[n]. Each name[i] is a unit of measurement and each c[i] is a conversion rate, telling you how many units of type name[i+1] are in a unit of type name[i]. For example, in the first sample input, this line tells you that there are 24 hours in one day, 60 minutes in each hour and 60 seconds in each minute. The value n indicates the total number of unit names and satisfies 2 <= n <= 10. All names are alphabetic strings with no blanks and always specify the plural form of the unit (which you should use for output no matter the value is associated with the unit). All conversion values are positive integers. Following this line is a single positive integer m <= 2,000,000,000 indicating an amount of the last unit (i.e., name[n]).

Output

For each test case,output two lines. The first line should give the closest conversion of the input amount to units specified by name[1], rounded to the nearest integer. The second line should do the same, but be a bit more precise using the two largest units -- name[1] and name[2]. When rounding, always round up when the fraction is >= 0.5. Note that there are no commas in the output.

Samples

4 days 24 hours 60 minutes 60 seconds
1000000
12 days
11 days 14 hours

Hint