Case #1: 5
Case #2: 2
Case #3: IMPOSSIBLE
Case #4: 5