VUDBOL5 - Ninja

no tags 

A ninja is practicing and he is very fast he can make two cuts in one second and his master give he a new challenge. The master take a cube, thrown through the air and quickly says four numbers. The ninja has to think fast to make two cuts and get desired values.

Given a cube of size N*N*N, he need to cut it into four entire pieces of size A, B, C and D. He needs to divide the cube in these pieces with only two cuts, one vertical and one horizontal.

Input

The input consists in multiple test cases.
Each test case begins a line containing five integers N (2 <= N <= 1000000), A, B, C y D (1 <= A, B, C, D <= 2^63).
The end of input is indicated by a line with five zeros. This is not a part of any test case.

Output

For each test case print "Possible" if it is possible to obtain the pieces and print "Impossible" if it is not possible to obtain the pieces with two cuts.

Example

Input:
2 5 1 1 1
2 2 2 2 2
3 12 3 6 6
0 0 0 0 0

Output:
Impossible
Possible
Possible

hide comments
uchiha: 2014-12-16 12:31:22

silly me 3 WA's cuz of wrong spellings :P

Last edit: 2014-12-16 12:31:35
Mr Tambourine Man: 2014-06-30 00:47:14

ull will work. Think a little with some examples. Easy Prob.

Cosmos: 2014-06-29 14:17:03

some clarifications
size = volume
and cuts can only be integral..
a useful testcase->
10 270 230 270 230
Impossible

Last edit: 2014-06-29 14:17:20
Shashi Kant Prasad: 2014-03-16 11:21:11

It seems that large values for each of A, B, C, D never appear in the same test case.

Gaurav: 2013-08-26 05:07:31

please see this solution and let me know wat is going wrong, it works very fine for me #9914335

Gaurav: 2013-08-24 12:25:06

someone please provide some tricky test cases, please

Gaurav: 2013-08-24 11:49:50

Hi can any1 provide sm good test cases, triky ones. is 2 8 0 0 0 a possible or impossible scenario.......please provide some good test cases

Last edit: 2013-08-24 12:20:31
John Stephanus Peter: 2013-08-06 19:22:01

Thanks Edwin Guzman great problem! learned a lot from this :D

5star: 2013-08-06 17:21:29

really tricky....Check for multiple test cases.....there are some really tricky ones.....

Last edit: 2013-08-06 17:30:52
praveen123: 2013-06-20 22:39:48

@Edwin Guzman, Could you help me where my code is going wrong??


Added by:Edwin Guzman
Date:2012-04-25
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ASM32-GCC MAWK BC C-CLANG C NCSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JAVA JS-MONKEY JULIA KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 PY_NBC R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET