Consider a game involving four switches, each represented by a non-negative integer indicating its position. The first switch can be set between and , the second between and , the third between and , and the fourth between and .
Initially, all switches are at position . The objective is to move each switch to its maximum position—, , , and respectively—in the fewest moves possible.
During each move, you can choose one switch that is not yet at its maximum position and increase its value by . Simultaneously, each of the other switches may independently change its position: with equal probability, a switch can increase by , decrease by , or stay the same. If a switch is at position , it can only increase by or remain unchanged. Similarly, if a switch is at its maximum position, it can only decrease by or remain unchanged, each with equal probability.
Your task is to calculate the average number of moves needed to bring all switches from position (, , , ) to (, , , ), assuming optimal play.
The input consists of a single line with four integers , , , and (1 \le a, b, c, d \le 4).
Output a single number representing the expected number of moves required to complete the game optimally, with a precision of at least 10^{-6}.
Example 1