VUDBOL5 - Ninja

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

ID RESULT TIME
code...



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

hide comments
2014-12-16 12:31:22 uchiha
silly me 3 WA's cuz of wrong spellings :P


Last edit: 2014-12-16 12:31:35
2014-06-30 00:47:14 Mr Tambourine Man
ull will work. Think a little with some examples. Easy Prob.
2014-06-29 14:17:03 Cosmos
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
2014-03-16 11:21:11 Shashi Kant Prasad
It seems that large values for each of A, B, C, D never appear in the same test case.
2013-08-26 05:07:31 Gaurav
please see this solution and let me know wat is going wrong, it works very fine for me #9914335
2013-08-24 12:25:06 Gaurav
someone please provide some tricky test cases, please
2013-08-24 11:49:50 Gaurav
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
2013-08-06 19:22:01 John Stephanus Peter
Thanks Edwin Guzman great problem! learned a lot from this :D
2013-08-06 17:21:29 5star
really tricky....Check for multiple test cases.....there are some really tricky ones.....

Last edit: 2013-08-06 17:30:52
2013-06-20 22:39:48 praveen123
@Edwin Guzman, Could you help me where my code is going wrong??
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.