Problem:
Score: 200 points

Problem Statement

M-kun has the following three cards:

A red card with the integer A.

A green card with the integer B.

A blue card with the integer C.

He is a genius magician who can do the following operation at most K times:

Choose one of the three cards and multiply the written integer by 2.

His magic is successful if both of the following conditions are satisfied after the operations:

The integer on the green card is strictly greater than the integer on the red card.

The integer on the blue card is strictly greater than the integer on the green card.

Determine whether the magic can be successful.

Constraints

1 \leq A, B, C \leq 7

1 \leq K \leq 7

All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B C
K

Output

If the magic can be successful, print Yes; otherwise, print No.

Sample Input 1

7 2 5
3

Sample Output 1

Yes

The magic will be successful if, for example, he does the following operations:

First, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.

Second, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.

Third, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.

Sample Input 2

7 4 2
3

Sample Output 2

No

He has no way to succeed in the magic with at most three operations.

Solution in Scala (2.13.1) (judge verdict: Accepted)

import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val A, B, C, K = sc.nextInt

  @scala.annotation.tailrec
  def loop(A: Int = A, B: Int = B, C: Int = C, count: Int = 1): Boolean = {
    if (B > A && C > B) true
    else if (count > K) false
    else if (B <= A) loop(A, B * 2, C, count + 1)
    else if (C <= B) loop(A, B, C * 2, count + 1)
    else loop(A, B, C, count + 1)
  }

  val z = if (loop()) "Yes" else "No"
  println(z)
}