Math problems 6-8 grade
Valya and a letter
Valya was tired of social networks and decided to write a letter to her friend Sasha on a rectangular sheet of paper. The lengths of the sides of the sheet are equal to n and m centimeters. Then she found a rectangular envelope with side lengths equal to h and w centimeters.
Unfortunately, the letter may not fit into the envelope, in this case Valya have to fold the letter several times. In one action, Valya can fold the letter in half vertically or horizontally.
After Valya, if necessary, folds the letter in half several times, she plans to put it into the envelope. Valya is a very neat girl, she always puts a letter in an envelope so that its sides are parallel to the sides of the envelope. A letter is placed in an envelope if its sides are not longer than the corresponding sides of the envelope. Before putting the letter into the envelope, Valya can rotate it 90 degrees. For example, if the lengths of the sides of the letter are 10 and 20 centimeters, and the lengths of the sides of the envelope are 20 and 10 centimeters, Valya does not need to fold the letter, she can rotate it 90 degrees and put into an envelope.
Valya does not want the letter to be very wrinkled, so she wants to fold the letter in half the minimum number of times. Help her figure out the minimum number of times she has to fold the letter before she can put it in the envelope.
The first line contains four integers n, m, h and w (1 ≤ n, m, h, w ≤
1018), the lengths of the sides of the letter and envelope, respectively.
Print one number, the minimum number of times Valya has to fold the letter so that she can put it into the envelope.
10 20 20 10
3 3 2 2
576460752303423489 576460752303423489 1 1