atcoder#ABC222H. [ABC222H] Beautiful Binary Tree

[ABC222H] Beautiful Binary Tree

Score : 600600 points

Problem Statement

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

  • Each vertex has 00 or 11 written on it.
  • Each vertex that is a leaf has 11 written on it.
  • It is possible to do the following operation at most N1N-1 times so that the root has NN written on it and the other vertices have 00 written on them.- Choose vertices uu and vv, where vv must be a child of uu or a child of "a child of uu." Let auau+av,av0a_u \gets a_u + a_v, a_v \gets 0, where aua_u and ava_v are the numbers written on uu and vv, respectively.

Given NN, find the number, modulo 998244353998244353, of beautiful binary trees of degree NN.

Constraints

  • 1N1071 \leq N \leq 10^7
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

Output

Print the answer.

1
1

The only binary tree that satisfies the condition is a tree with one vertex whose root has 11 written on it.

2
6

The binary trees that satisfy the condition are the six trees shown below.

image

222
987355927
222222
675337738