The Snail

Time limit1sMemory limit128 MB

Problem

A snail is at the bottom of a well that is $H$ feet deep and wants to climb to the top. During the day, while the sun is up, the snail climbs upward; at night, while it sleeps, it slides back down.

On the first day the snail climbs $U$ feet. However, the snail grows tired, so it climbs a little less each day. Specifically, on day $n$ the snail climbs $U - (n-1)\times U \times \dfrac{F}{100}$ feet. (The distance lost to fatigue is always $F%$ of the first day's climbing distance.) If this value is negative, the snail does not climb at all that day (it climbs a distance of 0). No matter how far it climbed during the day, at night the snail always slides down $D$ feet.

The moment the snail's height first exceeds the well's height of $H$ feet, it leaves the well. Conversely, if after sliding at night its height becomes negative, the snail has slid back to the bottom of the well and fails. (A day consists of a period of sunlight followed by a period of darkness.)

For example, when $H=6,\ U=3,\ D=1,\ F=10$, the snail leaves the well on the third day, as shown in the table below.

DayInitial HeightDistance ClimbedHeight After ClimbingHeight After Sliding
10′3′3′2′
22′2.7′4.7′3.7′
33.7′2.4′6.1′

Depending on the parameters, the snail will eventually either leave the well (its height exceeds $H$) or slide back to the bottom (its height becomes negative). Determine which happens first, and on which day.

Input

The input consists of one or more test cases, each on a line by itself. Each line contains four integers $H,\ U,\ D,\ F$ separated by single spaces.

  • $H$: the height of the well in feet
  • $U$: the distance the snail climbs during the day in feet
  • $D$: the distance the snail slides down at night in feet
  • $F$: the fatigue factor expressed as a percentage

A line with $H = 0$ signals the end of the input and is not processed. Otherwise all four integers are between $1$ and $100$, inclusive. The snail never climbs a negative distance: if fatigue drops the climbing distance below zero, the snail does not climb at all that day. Regardless of how far it climbed, it always slides $D$ feet at night.

Output

For each test case, output a single line.

If the snail leaves the well (success), print:

success on day <n>

If the snail slides back to the bottom (failure), print:

failure on day <n>

where <n> is the number of the day on which the event occurs.