Problem BG
Lifting Walls

The local building firm needs your help. They are building
an apartment building where the walls are prefabricated and
lifted in place using cranes. The building firm has located
The house that is to be built is rectangular with a length
Task
Find the minimum number of cranes required to reach the center of all four walls.

Input
The first line of input contains four space-separated
positive integers
This is followed by
Output
Output one integer, the minimum number of cranes required to reach all wall segments, or Impossible if not all wall segments can be reached.
Sample Input 1 | Sample Output 1 |
---|---|
4 2 3 3 1 -2 4 0 -1 2 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
6 1 1 1 1 0 |
Impossible |