Wagon-Lit Co., the worldwide famous train company, runs every working-day X-Express, an important train that links twice a day (early in the morning, and in the evening) Paris to Brussels and Amsterdam. Each train composition has at least two wagons: one 1.st class, with capacity for 48 passengers; and one 2.nd class, with capacity for 64 passengers. However to determine the minimal number of wagons for each travel is not so easy because X-Express passengers have very strict rules for allocation inside the train: • Politicians and Businessmen always travel in 1.st class, but never in the same wagon; • Artists and Young people always travel in 2.nd class, but never in the same wagon; • Tourist always travel in 2.nd class, but they don’t care the wagon (they can be mixed with artists or young people); • The Regular passengers prefer to travel in 2.nd class, but they can also be placed in 1.st class (in order to keep minimal the number of wagons), and they can also be sited together with any other class of people. Your task is to write a program to read the booking-list and to compute the minimal number of 1.st and 2.nd class wagons that shall be included at Paris to assure place for everybody in the list, complying the strict rules above. Notice that some passengers leave the train at Brussels, and others get on there, but the train composition will not change (it arrives at Amsterdam with the same number of wagons that were included at Paris). Also notice that passengers that booked a ticket from Paris to Amsterdam can change wagon at Brussels. Input The input will contain several test cases, each of them as described below. Consecutive test cases are separated by a single blank line. The input is a file (stdin) with just three lines, each one with 6 integers separated by a single space. The 6 integers represent the number of Politicians, Businessmen, Artists, Young people, Tourist, and Regular passengers that booked a ticket from Paris to Amsterdam (1.st line), Paris to Brussels (2.nd line), and Brussels to Amsterdam (3.rd line). Output For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line. The output should be written to a file (stdout) with two lines in the following format: • one line with the number of 1.st class wagons (always less than 100). • one line with the number of 2.nd class wagons (always less than 100).
2/2 Sample Input 20 120 50 80 100 30 40 80 5 10 100 40 15 12 20 100 30 20 Sample Output 7 6