Problem J2: Up and Down

Nikky and Byron are playing a silly game in gym class. Nikky is told by his teacher to walk forward a steps and then walk backward b steps, after which he repeats a forward, b backward, etc. Likewise, Byron is told to walk forward c steps and then walk backward d steps, after which he repeats c forward, d backward, etc. You may assume that a ≥ b and c ≥ d.

Byron and Nikky have the same length of step, and they are required to take their steps simultaneously (that is, Nikky and Byron will both step forward on their first steps at the same time, and this will continue for each step).

Nikky and Byron start walking from one end of a soccer field. After s steps, the gym teacher will blow the whistle. Your task is to figure out who has moved the farthest away from the starting position when the whistle is blown.

Input Format

The input will be the 5 integers a, b, c, d (1 ≤ abcd ≤ 100), and s (1 ≤ s ≤ 10000), each on a separate line.

Output Format

The output of your program will be one of three possibilities: `Nikky` if Nikky is farther ahead after s steps are taken; `Byron` if Byron is farther ahead after s steps are taken; `Tied` if Byron and Nikky are at the same distance from their starting position after s steps are taken.

```4
2
5
3
12```

`Byron`

Explanation

Notice that after 12 steps, Nikky has moved 4 − 2 + 4 − 2 steps, for a total of 4 steps from the starting position, whereas Byron has moved 5 − 3 + 4 steps, for a total of 6 steps from the starting position. Thus, Byron is ahead.

Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

• (0/0)

• (0/1)
alot of stuff

• (0/1)
remember, they can take less steps depending on how many steps that they are allowed to take, i suggest you use mod to help you solve this

• (0/0)
to xiao*******@gmail.com [partially redacted by admin]
How do you do this?

• (0/0)
How do you do this?

• (0/0)
I got error on 4th case and I don't know what's wrong

• (0/0)
We should explain in the question that s can be even or odd

• (0/0)
There is nothing in the statement to suggest the opposite. I don't think that such a specific clarification is necessary to add.

• (0/1)

• (10/0)

• (0/1)

• (0/0)
Surely you can be resourceful enough to find it yourself?
You'll find the problem set here.

• (0/0)
y is this 15 POINTS? shouldnt it be less due to how easy (im guessing) it is? and y would it take 60 seconds for u to find n, which is only up to 10??? OVERVALUED PROBLEM!!! (btw, im still guessing, so prove me wrong)

• (0/0)
This is a problem from the latest CCC; I presume that once a new one comes out (i.e. later this month ?), it'll be reset to the proper value.

• (0/0)
Actually, the point value will be updated when I get the contest system working properly.