{"problem":{"name":"B. The Modcrab","description":{"content":"Vova is again playing some computer game, now an RPG. In the game Vova's character received a quest: to slay the fearsome monster called Modcrab. After two hours of playing the game Vova has tracked ","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF903B"},"statements":[{"statement_type":"Markdown","content":"Vova is again playing some computer game, now an RPG. In the game Vova's character received a quest: to slay the fearsome monster called Modcrab.\n\nAfter two hours of playing the game Vova has tracked the monster and analyzed its tactics. The Modcrab has _h_2 health points and an attack power of _a_2. Knowing that, Vova has decided to buy a lot of strong healing potions and to prepare for battle.\n\nVova's character has _h_1 health points and an attack power of _a_1. Also he has a large supply of healing potions, each of which increases his current amount of health points by _c_1 when Vova drinks a potion. All potions are identical to each other. It is guaranteed that _c_1 > _a_2.\n\nThe battle consists of multiple phases. In the beginning of each phase, Vova can either attack the monster (thus reducing its health by _a_1) or drink a healing potion (it increases Vova's health by _c_1; **Vova's health can exceed _h_1**). Then, **if the battle is not over yet**, the Modcrab attacks Vova, reducing his health by _a_2. The battle ends when Vova's (or Modcrab's) health drops to 0 or lower. It is possible that the battle ends in a middle of a phase after Vova's attack.\n\nOf course, Vova wants to win the fight. But also he wants to do it as fast as possible. So he wants to make up a strategy that will allow him to win the fight after the minimum possible number of phases.\n\nHelp Vova to make up a strategy! You may assume that Vova never runs out of healing potions, and that he can always win.\n\n## Input\n\nThe first line contains three integers _h_1, _a_1, _c_1 (1 ≤ _h_1, _a_1 ≤ 100, 2 ≤ _c_1 ≤ 100) — Vova's health, Vova's attack power and the healing power of a potion.\n\nThe second line contains two integers _h_2, _a_2 (1 ≤ _h_2 ≤ 100, 1 ≤ _a_2 < _c_1) — the Modcrab's health and his attack power.\n\n## Output\n\nIn the first line print one integer _n_ denoting the minimum number of phases required to win the battle.\n\nThen print _n_ lines. _i_\\-th line must be equal to _HEAL_ if Vova drinks a potion in _i_\\-th phase, or _STRIKE_ if he attacks the Modcrab.\n\nThe strategy must be valid: Vova's character must not be defeated before slaying the Modcrab, and the monster's health must be 0 or lower after Vova's last action.\n\nIf there are multiple optimal solutions, print any of them.\n\n[samples]\n\n## Note\n\nIn the first example Vova's character must heal before or after his first attack. Otherwise his health will drop to zero in 2 phases while he needs 3 strikes to win.\n\nIn the second example no healing needed, two strikes are enough to get monster to zero health and win with 6 health left.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"Vova 再次玩一款电脑游戏，这次是一款 RPG。在游戏中，Vova 的角色接到了一个任务：击败可怕的怪物 Modcrab。\n\n在游戏两小时后，Vova 找到了这个怪物并分析了它的战术。Modcrab 拥有 #cf_span[h2] 点生命值和 #cf_span[a2] 点攻击强度。了解这些信息后，Vova 决定购买大量强力治疗药水并为战斗做准备。\n\nVova 的角色拥有 #cf_span[h1] 点生命值和 #cf_span[a1] 点攻击强度。此外，他拥有大量治疗药水，每瓶药水在 Vova 饮用后会将其当前生命值增加 #cf_span[c1]。所有药水都完全相同。保证 #cf_span[c1 > a2]。\n\n战斗由多个阶段组成。在每个阶段开始时，Vova 可以选择攻击怪物（从而将其生命值减少 #cf_span[a1]）或饮用一瓶治疗药水（将其生命值增加 #cf_span[c1]；*Vova 的生命值可以超过 #cf_span[h1]*）。然后，*如果战斗尚未结束*，Modcrab 会攻击 Vova，将其生命值减少 #cf_span[a2]。当 Vova 或 Modcrab 的生命值降至 #cf_span[0] 或更低时，战斗结束。战斗可能在某个阶段中途结束，即在 Vova 攻击之后。\n\n当然，Vova 希望赢得战斗，但他也希望尽可能快地完成。因此，他希望制定一个策略，使得在最少的阶段数内赢得战斗。\n\n帮助 Vova 制定策略！你可以假设 Vova 永远不会耗尽治疗药水，并且他总能获胜。\n\n第一行包含三个整数 #cf_span[h1], #cf_span[a1], #cf_span[c1]（#cf_span[1 ≤ h1, a1 ≤ 100]，#cf_span[2 ≤ c1 ≤ 100]）——分别表示 Vova 的生命值、攻击强度和药水的治疗强度。\n\n第二行包含两个整数 #cf_span[h2], #cf_span[a2]（#cf_span[1 ≤ h2 ≤ 100]，#cf_span[1 ≤ a2 < c1]）——分别表示 Modcrab 的生命值和攻击强度。\n\n第一行输出一个整数 #cf_span[n]，表示赢得战斗所需的最少阶段数。\n\n然后输出 #cf_span[n] 行。第 #cf_span[i] 行必须为 _HEAL_，表示在第 #cf_span[i] 阶段 Vova 饮用了药水；或为 _STRIKE_，表示他在该阶段攻击了 Modcrab。\n\n策略必须有效：Vova 的角色在击败 Modcrab 前不能被击败，且在 Vova 最后一次行动后，怪物的生命值必须为 #cf_span[0] 或更低。\n\n如果有多个最优解，输出任意一个即可。\n\n在第一个示例中，Vova 的角色必须在第一次攻击前或后进行治疗。否则，他的生命值将在 #cf_span[2] 个阶段后降为零，而他需要 #cf_span[3] 次攻击才能获胜。\n\n在第二个示例中，无需治疗，两次攻击足以将怪物生命值降至零，并以 #cf_span[6] 点生命值获胜。\n\n## Input\n\n第一行包含三个整数 #cf_span[h1], #cf_span[a1], #cf_span[c1]（#cf_span[1 ≤ h1, a1 ≤ 100]，#cf_span[2 ≤ c1 ≤ 100]）——Vova 的生命值、攻击强度和药水的治疗强度。第二行包含两个整数 #cf_span[h2], #cf_span[a2]（#cf_span[1 ≤ h2 ≤ 100]，#cf_span[1 ≤ a2 < c1]）——Modcrab 的生命值和攻击强度。\n\n## Output\n\n第一行输出一个整数 #cf_span[n]，表示赢得战斗所需的最少阶段数。然后输出 #cf_span[n] 行。第 #cf_span[i] 行必须为 _HEAL_，表示在第 #cf_span[i] 阶段 Vova 饮用了药水；或为 _STRIKE_，表示他在该阶段攻击了 Modcrab。策略必须有效：Vova 的角色在击败 Modcrab 前不能被击败，且在 Vova 最后一次行动后，怪物的生命值必须为 #cf_span[0] 或更低。如果有多个最优解，输出任意一个即可。\n\n[samples]\n\n## Note\n\n在第一个示例中，Vova 的角色必须在第一次攻击前或后进行治疗。否则，他的生命值将在 #cf_span[2] 个阶段后降为零，而他需要 #cf_span[3] 次攻击才能获胜。在第二个示例中，无需治疗，两次攻击足以将怪物生命值降至零，并以 #cf_span[6] 点生命值获胜。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ h_1, a_1, c_1 \\in \\mathbb{Z}^+ $ denote Vova’s initial health, attack power, and healing power per potion, respectively.  \nLet $ h_2, a_2 \\in \\mathbb{Z}^+ $ denote Modcrab’s health and attack power, respectively, with $ c_1 > a_2 $.  \n\nLet $ n \\in \\mathbb{Z}^+ $ be the number of phases.  \nLet $ s_i \\in \\{\\text{STRIKE}, \\text{HEAL}\\} $ denote Vova’s action in phase $ i $.  \nLet $ H_i \\in \\mathbb{Z} $ denote Vova’s health at the start of phase $ i $, with $ H_1 = h_1 $.  \nLet $ M_i \\in \\mathbb{Z} $ denote Modcrab’s health at the start of phase $ i $, with $ M_1 = h_2 $.  \n\n**Constraints**  \n1. $ 1 \\leq h_1, a_1 \\leq 100 $, $ 2 \\leq c_1 \\leq 100 $, $ 1 \\leq h_2 \\leq 100 $, $ 1 \\leq a_2 < c_1 $.  \n2. For each phase $ i $:  \n   - If $ s_i = \\text{STRIKE} $: $ M_{i+1} = M_i - a_1 $, and $ H_{i+1} = H_i - a_2 $ (if $ M_{i+1} > 0 $).  \n   - If $ s_i = \\text{HEAL} $: $ H_{i+1} = H_i + c_1 $, and $ M_{i+1} = M_i $ (if $ M_i > 0 $).  \n3. Battle ends when $ M_k \\leq 0 $ for some $ k \\leq n $, and $ H_i > 0 $ for all $ i \\leq k $.  \n4. $ M_{n+1} \\leq 0 $, and $ H_i > 0 $ for all $ i \\in \\{1, \\dots, n\\} $.  \n\n**Objective**  \nMinimize $ n $, the number of phases, and output a sequence $ s_1, s_2, \\dots, s_n $ satisfying the above.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF903B","tags":["greedy","implementation"],"sample_group":[["10 6 100\n17 5","4\nSTRIKE\nHEAL\nSTRIKE\nSTRIKE"],["11 6 100\n12 5","2\nSTRIKE\nSTRIKE"]],"created_at":"2026-03-03 11:00:39"}}