Greedy’s Pizza

Larry loves eating at Greedy’s when they cook their Pepperoni pizzas, but—as the name suggests—the restaurant’s owners are very greedy in their commer- cial strategies and they only sell one kind of pizza ev- ery day. Even worse, they never announce the flavour they are currently cooking, so Larry orders his pizza without knowing what will be its flavour until it ar- rives. Tired of this, he has collected some information and this is what he got: if they cook a certain flavour on day D of this week, there’s a probability of 0.6 that the next week they will use that same flavour on day D + 1, a probability of 0.4 for the day D + 2, and a probability of 0 for all the other days of next week (incuding D). Saturday’s pizza will be repeated on Sunday or Monday of next week, Sunday’s flavour will repeat on Monday or Tuesday, and so on. Given the selection of days when they cooked Pepperoni pizzas this week, output the probability distribution for next week, to help Larry decide on which day he should go to eat at Greedy’s. Input The input consists of several test cases. Each test case is a single line with 7 integers, one for each day of the week (starting on Monday). If the number is 1, it indicates that Greedy’s cooked Pepperoni pizzas that day, 0 otherwise. Output For each test case, print a single line with the distribution of probabilities for next week, separating the values with spaces. Answers with a relative or absolute error less than 10−4 will be considered correct. Sample Input 1100000 1111111 Sample Output 0 0.3 0.5 0.2 0 0 0 0.1429 0.1429 0.1429 0.1429 0.1429 0.1429 0.1429