409523: GYM103624 B Balanced Cannons

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Balanced Cannonstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

For purposes of self-defense and of course raiding other ships, cannons on board are essential to any pirate fleet. Jeanne de Clisson is taking inventory of the cannons on her flagship My Revenge, noting how many are currently lined up on both the port and starboard sides. However, cannons can be heavy enough to weigh down a ship, and if balanced incorrectly, they can potentially tip it over in the water! Help Jeanne analyze the layout of cannons on her ship and determine if they are in balance.

Input

The first line of input contains two space-separated integers $$$W$$$ ($$$1 \leq W \leq 1000$$$), denoting the weight of each cannon, and $$$D$$$ ($$$1 \leq D \leq 10^9$$$), denoting the maximum weight difference allowed between the two sides of the ship in order for it to be considered balanced.

Then the second line of input contains two integers $$$C_p$$$ and $$$C_s$$$ ($$$1 \leq C_p, C_s \leq 10^6$$$), denoting the number of cannons currently lined on the port and starboard sides of the ship respectively.

Output

If the port and starboard sides of the ship are already balanced, print In balance. If they are not in balance but cannons on either side could be moved across to produce a balanced configuration, print Move cannons. Otherwise, print Impossible.

ExamplesInput
6 6
1 6
Output
Move cannons
Input
4 4
7 8
Output
In balance

加入题单

上一题 下一题 算法标签: