FIFA wants to slightly change the World Cup's tournament format. Currently, 32 teams take part and the competition consists of two rounds.
The first round is the group stage. The 32 teams are split into 8 groups, and within a group every team plays each of the other teams once, for a total of three matches each. After the group stage, the top two teams of each group advance to the next round, the knockout tournament.
The tournament's first round has 16 teams and 8 matches; the winner of each match advances. The second round has 4 matches, whose winners reach the semifinals. The two semifinal winners play in the final, and the winner of the final wins the World Cup.
For the knockout tournament to be fair, the number of teams entering it must always be a power of two.
FIFA wants to increase both the number of teams in the group stage and the number of groups. As a result, the number of teams entering the tournament may change. FIFA also wants to change the rules so that some teams (the previous champion, the host nation, and so on) skip the group stage and go straight to the tournament. Given how the World Cup is changed, write a program that computes how many matches are played in total.
The input consists of several test cases. Each test case is given as four natural numbers $G$, $T$, $A$, $D$.
It is always true that $0 < A \le T$, and none of the four numbers exceeds $2^{16}$.
If the number of teams entering the tournament is not a power of two, teams must be added up to the nearest power of two that is not smaller than it.
The last line of the input contains four $-1$s; this line is not processed.
For each test case, print one line in the following format.
G*A/T+D=X+Y
Here $G$, $A$, $T$, $D$ are the numbers given in the input, $X$ is the total number of matches played, and $Y$ is the number of teams that must be added.