{"problem":{"name":"Large Heap","description":{"content":"Consider a permutation $P=(P_1,P_2,\\cdots,P_{2^N-1})$ of $(1,2,\\cdots,2^N-1)$. $P$ is said to be **heaplike** if and only if all of the following conditions are satisfied. *   $P_i < P_{2i}$ ($1 \\leq","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":10000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc060_c"},"statements":[{"statement_type":"Markdown","content":"Consider a permutation $P=(P_1,P_2,\\cdots,P_{2^N-1})$ of $(1,2,\\cdots,2^N-1)$. $P$ is said to be **heaplike** if and only if all of the following conditions are satisfied.\n\n*   $P_i < P_{2i}$ ($1 \\leq i \\leq 2^{N-1}-1$)\n*   $P_i < P_{2i+1}$ ($1 \\leq i \\leq 2^{N-1}-1$)\n\nYou are given integers $A$ and $B$. Let $U=2^A$ and $V=2^{B+1}-1$.\nFind the probability, modulo $998244353$, that $P_U<P_V$ for a heaplike permutation chosen uniformly at random.\n\nDefinition of probability modulo $998244353$\n\nIt can be proved that the sought probability is always rational. Additionally, under the constraints of this problem, when the sought rational number is represented as an irreducible fraction $\\frac{P}{Q}$, it can be proved that $Q \\neq 0 \\pmod{998244353}$. Therefore, there is a unique integer $R$ such that $R \\times Q \\equiv P \\pmod{998244353}$ and $0 \\leq R \\lt 998244353$. Print this $R$.\n\n## Constraints\n\n*   $2 \\leq N \\leq 5000$\n*   $1 \\leq A,B \\leq N-1$\n*   All numbers in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $A$ $B$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc060_c","tags":[],"sample_group":[["2 1 1","499122177\n\nThere are two heaplike permutations: $P=(1,2,3),(1,3,2)$. The probability that $P_2<P_3$ is $1/2$."],["3 1 2","124780545"],["4 3 2","260479386"],["2022 12 25","741532295"]],"created_at":"2026-03-03 11:01:14"}}