Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

C24E07DE - EC07D Race Track (E)

Fuel is of central importance in all motor sports, as it is a serious embarrassment for a team if they run out of fuel during a race. Precise planning is crucial and your help is needed for it. There is a circular race track of k kilometers, where k is a positive integer. There is a fuel station after each kilometer on the track. So for example in a 5 km long track there are 5 stations. Each station has a certain amount of fuel, and when the car reaches a station, all the station's fuel is loaded into the cars tank. (The tank can be considered to have an infinite capacity.) The car has an empty tank at the beginning, so it has to start from a fuel station.

The starting fuel station can be chosen arbitrarily. Some choices can lead to the fuel depleting between stations while others can enable the car to complete a full lap. The team has an expert for picking the best starting location, but he requests that a program be written for determining if it is even possible to pick a station that would enable the completion of a full lap. He does not enjoy getting up in vain.

The amount of fuel in each station is given by the following recursion (we denote the amount of fuel in station k with Fk):

F1 = A
Fi = (Fi-1B + C)
mod M

Input:

Each test case is specified by one line, containing 6 integers N, F, A, B, C, M. N is the length of the track in kilometers (that is the number of the stations), F is the amount of fuel needed to drive one kilometer, A, B, C and M are the parameters in the recursion above.

Output:

For each test case, you have to output a single line containing the word POSSIBLE (if there is a station that enables completing a full lap) or IMPOSSIBLE (if there is no such station).

This is the electronic variant of the problem. Read more here about submitting solutions!

Example

Input:
3 2 2 0 2 10
1 3 2 0 2 10

Output:
POSSIBLE
IMPOSSIBLE

Added by:Jacek DÄ…browski
Date:2009-02-13
Time limit:0.200s-2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:ADA95 ASM32 BASH BF C CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TEXT WHITESPACE
Resource:Challenge 24 2007 Electronic Contest

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.