We need to determine winner in a turn-based attack between two monsters. Takahashi's monster: health A, strength B. Aoki's monster: health C, strength D. Turns: Takahashi attacks first (his monster attacks Aoki's monster), then Aoki attacks, etc. Each attack reduces opponent's health by attacker's strength. Continue until one monster's health <= 0; the owner of that monster loses, other wins. So we need to see who dies first.
Given constraints small (up to 100). Could simulate, but also derive condition. Let's think: Takahashi attacks first. The number of attacks needed by Takahashi to kill Aoki's monster: minimum number of attacks t_T such that t_T * B >= C. Actually each attack reduces C by B. So after k attacks from Takahashi, Aoki's health becomes C - k*B. It becomes <=0 when k >= ceil(C / B). Let k_T = ceil(C / B). Similarly, Aoki's attacks needed to kill Takahashi's monster: k_A = ceil(A / D). However, turns: Takahashi attacks first, then Aoki, then Takahashi, etc. So we need to compare who dies first given attack order.
The sequence: Turn 1: Takahashi attacks. After that, if C <= 0, Takahashi wins immediately (Aoki's monster dead). Else, turn 2: Aoki attacks. After that, if A <= 0, Takahashi loses. Then turn 3: Takahashi attacks, etc.
So essentially, we compare the number of attacks each can survive. Since Takahashi attacks first, he will win if his monster survives long enough to deliver the killing blow. More precisely: Takahashi wins if the number of attacks he needs to kill Aoki's monster (k_T) is <= the number of attacks his monster can withstand (k_A). Because his monster gets attacked after each of his attacks (except possibly after the killing blow). Actually careful: The order: In each "round" (if both survive), Takahashi attacks, then Aoki attacks. So the number of Aoki's attacks that happen is either equal to the number of Takahashi's attacks (if Takahashi kills after his attack, then no further Aoki attack), or one less (if Aoki kills after his attack, then no further Takahashi attack). More formally, let t = number of attacks performed by Takahashi's monster, and a = number of attacks performed by Aoki's monster. The game ends when either after a Takahashi attack the opponent's health <=0, or after an Aoki attack the opponent's health <=0.
We can think in terms of time steps. Let’s denote:
If Takahashi needs k_T attacks to reduce C to <=0, i.e., the smallest integer such that k_T * B >= C. Similarly, k_A is smallest integer such that k_A * D >= A.
Now, the sequence: Attack number 1: T attacks. If k_T = 1, T wins immediately. If not, then attack 2: A attacks. If k_A = 1, then after this attack, T's health <=0, so T loses. If not, continue.
Generally, after i T attacks and i A attacks (i full rounds), both have attacked i times. The health: C after i T attacks: C - iB. A after i A attacks: A - iD. If C - iB <= 0 after T's i-th attack, then T wins before A's i-th attack? Actually it's after T's attack. So at the moment after T's i-th attack, if C - iB <= 0, game ends, T wins; no further A attack in that round. So T wins if there exists i such that i*B >= C and before that, (i-1)*D < A (i.e., A survived previous A attacks). Because Aoki attacks after each T attack except possibly the last one. Specifically, before T's i-th attack, Aoki would have attacked i-1 times (since after each T attack except possibly the last, A attacks). So for T to win on his i-th attack, we need: (i-1)D < A (so that T's monster hasn't died before his i-th attack) and iB >= C. Since i is integer >=1.
Similarly, T loses if Aoki kills on his i-th attack (i-th A attack). After A's i-th attack, T's health <=0. That occurs if iD >= A, and before that, iB < C (i.e., T has not already killed Aoki on his i-th attack? Actually order: in a round, T attacks first, then A attacks. So A's i-th attack occurs after T's i-th attack. So for A to kill on his i-th attack, we require that after T's i-th attack, C > 0 (otherwise game would have ended before A's attack). So conditions: iB < C (so T didn't kill on his i-th attack) and iD >= A. Also, before that, T's monster must still be alive at start of that round? Actually start: T attacks first. So before A's i-th attack, T has already survived i-1 A attacks? Wait careful: Let's index turns: Turn 1: T attack #1. Turn 2: A attack #1. Turn 3: T attack #2. Turn 4: A attack #2. etc.
So A's i-th attack occurs at turn number 2i. Before that, T's monster has been attacked i-1 times? Actually after T's first attack, A attacks #1 (first A attack). So before A's i-th attack, the monster has survived i-1 A attacks? Let's check: A's 1st attack occurs after T's 1st attack. So before A's 1st attack, T's monster hasn't been attacked by A yet (i.e., 0 A attacks). So for i=1, A's first attack occurs; before that, T's monster health is A (no previous A attacks). So condition for A to kill on his first attack: D >= A (iD >= A with i=1) and also after T's first attack, C > 0 (iB < C with i=1). So we need iB < C (i = number of T attacks that occurred before this A attack). For i-th A attack, T has already attacked i times (since T attacks first each round). So before A's i-th attack, T has performed i attacks, and A has performed i-1 attacks. So the condition for A to kill on his i-th attack: after T's i-th attack, C > 0 (i.e., iB < C) and after A's i-th attack, A's health <=0: (i)D >= A. Also, note that before this A attack, T's health is still positive (otherwise game would have ended earlier). But we need to check that T's health was >0 before this A attack. But if iD >= A, then after i-1 attacks, (i-1)D might be < A, which ensures it's still alive before the i-th attack. But also need to consider possibility that A's i-th attack kills T even if earlier T attack could have killed A? Actually condition iB < C ensures T hasn't killed A on his i-th attack. So both conditions cover.
Thus we can decide winner by comparing k_T and k_A. The usual analysis: Since T attacks first, he wins if k_T <= k_A. Because he needs to land k_T attacks to kill, and he gets to attack on turns 1,3,5,... So the number of A attacks that occur before his k_T-th attack is k_T - 1. So for him to survive until delivering the killing blow, we need that k_T - 1 attacks from A are not enough to kill his monster: i.e., (k_T - 1)*D < A. That's equivalent to k_T - 1 < ceil(A / D) = k_A. Since k_A is the minimal number of A attacks to kill T's monster. So condition (k_T - 1) < k_A. This inequality can be rewritten as k_T <= k_A? Let's check: If (k_T - 1) < k_A, then k_T <= k_A because both integers. Actually if k_T - 1 < k_A, then k_T <= k_A (since k_T and k_A are integers, k_T -1 < k_A implies k_T <= k_A). Conversely, if k_T <= k_A, then k_T - 1 <= k_A -1, which might be less than k_A but could be equal to k_A? Actually if k_T <= k_A, then k_T -1 <= k_A -1, which is < k_A if k_A>=1. But it's possible that k_T -1 = k_A? That would require k_T = k_A+1, which is > k_A, so not allowed. So indeed k_T <= k_A is equivalent to k_T -1 < k_A (since if k_T <= k_A, then k_T -1 <= k_A -1 < k_A). Wait, need to check boundary: Suppose k_T = k_A. Then k_T -1 = k_A -1 < k_A, so condition holds. Suppose k_T = k_A+1, then k_T -1 = k_A, which is not < k_A. So indeed T wins if and only if k_T <= k_A. However, we must also consider the case when k_T = k_A, but does T's killing blow occur before A's killing blow? Since T attacks first in a round, if both would die on the same number of attacks (k_T = k_A), then T will attack first in that round, killing Aoki's monster before Aoki gets to attack. Because in the round when T would deliver his k_T-th attack (which is also the k_A-th attack for A? Actually A needs k_A attacks to kill T. If k_T = k_A, then both need same number of attacks. The order: T attacks first in each round. So by the time T has attacked k_T times, A has attacked k_T -1 times (since after each T attack except possibly last, A attacks). So T's k_T-th attack happens before A's k_T-th attack. Since k_T = k_A, A would need k_A attacks to kill, but only k_T-1 attacks have been delivered, which is less than k_A, so T is still alive. After T's attack, A's monster dies, game ends. So T wins. So condition k_T <= k_A yields T win.
But what about if k_T > k_A? Then T loses. Because A will deliver a killing blow on his k_A-th attack before T can deliver his k_T-th attack? Let's check: If k_T > k_A, then A needs fewer attacks. The number of full rounds before A's k_A-th attack: In the round where A performs his k_A-th attack, T will have performed either k_A attacks (since T attacks first) or k_A attacks? Actually if A is about to attack for the k_A-th time, then prior to that, T has attacked k_A times (since each A attack is preceded by a T attack, except possibly if game ended earlier). Let's sequence: T1, A1, T2, A2, ..., T_k, A_k. So before A_k, T has attacked k times. For A to kill on his k_A-th attack, we need that after T's k_A-th attack, C > 0 (i.e., k_A * B < C) and that k_A * D >= A. If k_T > k_A, then k_A * B < C (since k_T is the smallest integer with k_TB>=C, if k_A < k_T then k_AB < C). So condition holds. And also need that before A's k_A-th attack, T is alive? That's automatically if k_A*D >= A? Actually before A's k_A-th attack, T has taken k_A-1 attacks from A. But the condition for death on k_A-th attack is that after that attack health becomes <=0. So T could be alive before that attack. For k_A to be minimal, (k_A-1)*D < A, so T still alive. So yes, if k_T > k_A, then A kills first. So T loses.
Thus the condition is simply: Takahashi wins if ceil(C / B) <= ceil(A / D), else loses.
But careful: There might be edge cases with exact divisions? For example, if C is multiple of B, then exactly C/B attacks needed? Actually health becomes <=0 when health - k*B <=0 => k >= C/B. Minimal integer k is ceil(C/B). If C divisible by B, then after exactly C/B attacks, health becomes exactly 0 (or <=0) so monster dies. So k_T = C/B. Similarly for A and D.
Check examples:
Example1: A=10, B=9, C=10, D=10. k_T = ceil(10/9)=2 (since 19=9<10, 29=18>=10). k_A = ceil(10/10)=1. So 2 <= 1? false, so Takahashi loses -> No. Output matches.
Example2: A=46,B=4,C=40,D=5. k_T = ceil(40/4)=10 (since 40/4=10 exactly). k_A = ceil(46/5)=10 (since 45<46, need 10?). 46/5=9.2 => ceil=10. So 10 <= 10 true -> Yes. Output matches.
Thus solution is straightforward.
Implement: read A,B,C,D. Compute t_turns = (C + B - 1) // B, a_turns = (A + D - 1) // D. If t_turns <= a_turns: print Yes else No.
But wait, check some corner cases: A,B,C,D all >=1. If both need 1 turn: k_T=1, k_A=1 => T wins because he attacks first. Condition 1 <= 1 true => Yes, which is correct. For example, A=5,D=5 => k_A=1 (since 1*5>=5). C=5,B=5 => k_T=1. T attacks first and kills Aoki's monster, so T wins. Good.
If k_T=1, k_A=0? But k_A can't be 0 because A>=1, D>=1, so k_A>=1. So fine.
Thus answer is Yes if ceil(C/B) <= ceil(A/D).
But hold on: Is there any scenario where both kill at same time? Could both die simultaneously? In turn-based, simultaneous death not possible because attacks happen sequentially. But what if T attacks and reduces C to 0 or below, but also his own health is also 0 or below? That can't happen because his attack does not affect his own health. So simultaneous death would require after same attack both are <=0. That cannot happen because only one monster's health changes per attack. However, it's possible that after T's attack, Aoki's monster dies, but also T's monster had health 0 or below already? But if T's monster had health <=0, then the game would have ended already on Aoki's previous attack. So that's not possible. So no simultaneous death.
Thus condition stands.
Now we must output "Yes" or "No". Note capitalization exactly as in problem: Yes and No.
Implementation in Python: read input, compute, print.
But note: The problem statement says "If Takahashi will win, print Yes; if he will lose, print No." So it's a win/lose from Takahashi perspective.
So simple.
Double-check with some random test: A=1, B=1, C=1, D=100. Then k_T=1, k_A= ceil(1/100)=1. So T wins. Indeed T attacks first and kills A's monster. So yes.
A=100,B=1,C=1,D=1: k_T=1, k_A=100 => T wins, correct.
A=1,B=100,C=100,D=1: k_T= ceil(100/100)=1, k_A= ceil(1/1)=1 => T wins? Actually T attacks first: B=100, reduces C from 100 to 0, so T wins immediately. Yes.
A=100,B=1,C=100,D=1: k_T=100, k_A=100 => T wins? Let's simulate: Both need 100 attacks. T attacks first. After 99 full rounds (T attacks 99, A attacks 99), T health = 100-991=1, C health = 100-991=1. Then turn 199? Actually after 99 rounds, we had T attacks #99? Wait: Round i: T_i then A_i. After 99 rounds, T has attacked 99 times, A has attacked 99 times. Next turn: turn 197? Actually counting: 1: T1, 2: A1, ... after 198 turns (2*99) we have T99 and A99 done. Then turn 199: T100 (since T attacks next). So T100 kills C (since C=1, B=1). So T wins. So condition holds.
If k_T = k_A+1? Example: A=1,B=1,C=2,D=1: k_T = ceil(2/1)=2, k_A= ceil(1/1)=1. T loses: T attacks first, reduces C to 1. Then A attacks, reduces A from 1 to 0, so T loses. Condition: 2 <= 1? false, so No. Correct.
Edge: A=2, B=1, C=1, D=2: k_T=1, k_A= ceil(2/2)=1 => T wins, because T kills first. Indeed T attack: C from 1 to 0. So Yes.
Edge: A=2, B=2, C=3, D=2: k_T= ceil(3/2)=2, k_A= ceil(2/2)=1 => T loses? Simulate: T attack: C=3-2=1. A attack: A=2-2=0 -> T loses. So No. Condition correct.
Edge: A=100,B=100,C=100,D=1: k_T=1, k_A=100 => Yes. Good.
Thus solution is trivial.
Given constraints, we can even simulate but formula is fine.
Implementation:
def solve():
import sys
A,B,C,D = map(int, sys.stdin.read().split())
t_turns = (C + B - 1) // B
a_turns = (A + D - 1) // D
if t_turns <= a_turns:
print("Yes")
else:
print("No")
Now produce final answer. ```python
import sys
def main():
A, B, C, D = map(int, sys.stdin.read().split())
# minimal number of attacks needed to defeat the opponent
takahashi_attacks = (C + B - 1) // B # ceil(C / B)
aoki_attacks = (A + D - 1) // D # ceil(A / D)
if takahashi_attacks <= aoki_attacks:
print("Yes")
else:
print("No")
if name == "main":
main()