Under construction

Still being built. Things may change

In-jae, did you catch Mushmom?

Time limit1sMemory limit256 MB

Summary
Given In-jae's health A and attack B and Mushmom's health X and attack Y, find the fewest actions In-jae needs to defeat Mushmom.
Level

Medium6 of 10

Topics
Simulation, Shortest path
Solved
No attempts yet

Problem

In-jae spent a year failing to defeat an orange mushroom, and now he sets out on an adventure to settle things with Mushmom.

In-jae has health AA and attack BB. Mushmom has health XX and attack YY.

In-jae attacks first. The two take turns, and each may take one action per turn.

There are only three kinds of action.

  • Attack: deals damage equal to the current attack.
  • Counter: takes no damage this turn and deals damage equal to the opponent's attack. Health increases by 10% of the current health. Discard any fraction.
  • Buff: raises the current attack by 20% and triples the damage taken this turn only. Discard any fraction.

Mushmom can only attack.

Help In-jae find the way to hunt Mushmom in as few turns as possible.

Input

On the first line, input In-jae's health AA and attack BB, then Mushmom's health XX and attack YY, in that order.

(1≤A,X≤100,0001 \le A, X \le 100{,}000, 1≤B,Y≤10,0001 \le B, Y \le 10{,}000)

Output

On the first line, print the number of actions In-jae takes when Mushmom is hunted in the fewest possible actions.

Examples1

  1. Example 1

    Input
    2 5 10 5
    
    Expected output
    2