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
Rahul Jain: 2021-06-24 23:49:52

Easy peasy!

prashant sakerwal: 2020-04-28 08:55:07

1522 :P

Last edit: 2020-04-28 08:55:41
markaman: 2019-01-03 15:14:21

Come Back and a[o] cost me multiple wa

Last edit: 2019-01-03 15:14:40
ankit1cool: 2018-06-23 10:33:30

Read carefully she needs to come back also

abhi_3421: 2018-06-22 18:46:25

I think the question is not able to clearly specify that maximum capacity of the tank is 200 . You can't exceed it instead of the fact that if you have some petrol left at particular station and you recharge it with 200 ,then the sum might exceed 200 which is not possible as per demand in question.

sunny: 2017-05-26 08:37:45

Don't forget to read the last line & Take care about end cases. caused me 4 WA's. :-( .

amalik123: 2017-03-25 18:28:25

easy one ,silly mistake of typing words in lowercase cost 1 WA

sachinsharma12: 2017-01-18 10:13:20

Ac in 1 go....easy one

af_nisa: 2016-09-22 12:15:34

what are the possible test cases?Cause my code seems to be working fine but not getting accepted.

Baqir khan : 2016-07-18 08:05:46

@infernodragon She starts from 0, at 1400 she refills, she goes to 1422. She comes back, refills at 1400 again, and goes to 1200 (1400-1200 = 200)


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