Under construction

Still being built. Things may change

Escalator

Interview

Time limit1sMemory limit1024 MB

Summary
Given escalator length, standing and walking speeds, two entry rates, and two queue lengths, decide which line reaches the top first.
Level

Medium4 of 10

Topics
Math, Simulation, Implementation, Greedy
Solved
No attempts yet

Problem

Paulina Osqulda (Osqulda is a student slang term for engineering students at the Royal Institute of Technology in Stockholm, see https://sv.wikipedia.org/wiki/Osquar_och_Osqulda.) studies at KTH in Stockholm and takes the subway to school every morning. When she reaches her subway station, she has to ride up an escalator to get out.

Two different lines often form at the escalator. On the right side of the escalator, people who want to stand still line up, while on the left side people line up if they prefer to walk in the escalator (to get up faster).

Paulina has noticed that a very long line usually forms on the left side of the escalator, because everyone is so stressed about getting to work and wants to be able to walk quickly up the escalator. Lately she has been wondering whether it might even be faster to choose the right line instead, since that line is often shorter.

The escalator is a total of MM steps long. If you stand in the escalator, you travel SS steps per second upward. If you walk in the escalator instead, you travel GG steps per second upward.

In total, AA people per second can step onto the escalator from the left line, while BB people per second can step onto the escalator from the right line. This means that at the start of the process, one person steps onto the escalator. Before a new person steps onto the escalator, that person must wait 1A\frac{1}{A} (respectively 1B\frac{1}{B}) seconds to be able to step onto the escalator.

The left line is currently LL people long, and the right line is RR people long.

Help Paulina decide which line to stand in so that she reaches the top of the escalator as quickly as possible.

Input

The first line of the input consists of the integers M,S,GM, S, G described in the problem. It holds that 30≤M≤20030 \le M \le 200, 1≤S≤G≤M1 \le S \le G \le M.

The next line contains the real numbers A,BA, B described in the problem. It holds that 0.1≤A,B≤10.1 \le A, B \le 1.

The last line contains the integers L,RL, R described in the problem. It holds that 0≤L,R≤1000 \le L, R \le 100.

Output

Print latmask if the fastest option is to choose the right line and stand in the escalator, or friskus if the fastest option is to choose the left line and walk in the escalator.

It is guaranteed that the time for Paulina to ride up the escalator differs by at least 1 second between the two lines, so you never need to worry about the case where both options are equally fast.

Examples3

  1. Example 1

    Input
    50 1 2
    1 1
    0 0
    
    Expected output
    friskus
    
  2. Example 2

    Input
    50 1 1
    1 0.5
    7 3
    
    Expected output
    latmask
    
  3. Example 3

    Input
    100 2 4
    0.5 0.3
    52 24
    
    Expected output
    friskus