SCPC11B - Alaska

no tags 

The Alaska Highway runs 1422 miles from Dawson Creek, British Columbia to Delta Junction, Alaska. 

Brenda would like to be the first person to drive her new electric car the length of the highway. Her car can travel up to 200 miles once charged at a special charging station. There is a charging station in Dawson Creek, where she begins her journey, and also several charging stations along the way. Can Brenda drive her car from Dawson City to Delta Junction and back?

Input

The input contains several scenario. Each scenario begins with a line containing n, a positive number indicating the number of charging stations. n lines follow, each giving the location of a filling station on the highway, including the one in Dawson City. The location is an integer between 0 and 1422, inclusive, indicating the distance in miles from Dawson Creek. No two filling stations are at the same location. A line containing 0 follows the last scenario.

Output

For each scenario, output a line containing POSSIBLE if Brenda can make the trip.

Otherwise, output a line containing the word IMPOSSIBLE.

Example

Input:
2
0
900
8
1400
1200
1000
800
600
400
200
0
0

Output:
IMPOSSIBLE
POSSIBLE

hide comments
mkfeuhrer: 2016-06-18 22:37:22

AC in 1 go :-) take care at ends..... rest is sort :-)

Divyaanand Sinha: 2016-01-18 14:19:02

didnt read the coming back part ,cost me 4 WA!!

lalit_nit: 2016-01-10 13:35:43

just a break; cause 4WA :(

Prakhar Dev Gupta: 2015-12-24 14:33:23

Forgetting to sort caused 2 WA.
But it is easy

thirupathireddy: 2015-09-29 11:44:21

it should be that car wont stop after filling before driving for 200 miles........

infernodragon: 2015-09-16 21:53:54

in the second test case how is the trip possible because once she fill at 1400 she still has to go 22 more km and therefore while returning needs a station at 1222 which is not present

sheshan: 2015-08-25 23:25:31

simple....
use sort....

ALi Ibrahim: 2015-07-26 11:24:18

First Accepted ^_^

knightwood: 2015-07-24 06:44:28

and back, cost me 7 WAs before noticing

SangKuan: 2015-07-04 10:16:30

easy


Added by:Ali Arous
Date:2011-10-19
Time limit:4.849s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Syrian Collegiate Programming Contest 2011