エクサウィザーズプログラミングコンテスト2021(AtCoder Beginner Contest 222)
H
Beautiful Binary Tree
AtCoder
⌀ 3477
原题
← G→
翻译中…

Problem Statement

翻译中…

For a positive integer $N$, a rooted binary tree that satisfies the following conditions is said to be a beautiful binary tree of degree $N$.

翻译中…
  • Each vertex has $0$ or $1$ written on it.
  • Each vertex that is a leaf has $1$ written on it.
  • It is possible to do the following operation at most $N-1$ times so that the root has $N$ written on it and the other vertices have $0$ written on them.
  • Choose vertices $u$ and $v$, where $v$ must be a child of $u$ or a child of "a child of $u$." Let $a_u \gets a_u + a_v, a_v \gets 0$, where $a_u$ and $a_v$ are the numbers written on $u$ and $v$, respectively.
翻译中…

Given $N$, find the number, modulo $998244353$, of beautiful binary trees of degree $N$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^7$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
1
Output #1
1
The only binary tree that satisfies the condition is a tree with one vertex whose root has $1$ written on it.
Input #2
2
Output #2
6
The binary trees that satisfy the condition are the six trees shown below. ![image](https://img.atcoder.jp/ghi/37c6125e227d459cd725b6ccec96e2c8.png)
Input #3
222
Output #3
987355927
Input #4
222222
Output #4
675337738
题目信息

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。