Universal Cup Judging System

Universal Cup

时间限制: 4.0 s 内存限制: 1024 MB 总分: 100 可 Hack ✓
统计

After ending his international football career, Cristiano Ronaldo decided that he wants to become a citizen of Niue. To do so, he must pass an exam on Niuean traditions and culture. He answered all the questions easily except for the last one, so he needs your help. Can you help Ronaldo become a citizen of Niue? Here is the final question:

“For array $a_1, a_2, \ldots, a_n$ of positive integers we define it’s nativeness as $\sum_{i=1}^{n} a_i \cdot f_i$, where $f_0 = 1$, $f_1 = 1$ and for $i \ge 2$: $f_i = a_{i-1}f_{i-1} + f_{i-2}$.

Also, we will call an array niuean if it is lexicographically smaller than it’s reverse.

You are given an integer $m$. Please calculate how many niuean arrays have nativeness not bigger than $m$. Give your answer modulo $998\,244\,353$.”

Input

The first line contains one integer $m$ ($1 \le m \le 10^{10}$).

Output

Output number of arrays modulo $998\,244\,353$.

Examples

Input 1

6

Output 1

1

Input 2

7

Output 2

2

Input 3

13

Output 3

8

Input 4

42

Output 4

114

Input 5

67

Output 5

305

Input 6

6767

Output 6

3471737

Input 7

676767

Output 7

863282261

Input 8

67676767

Output 8

217404956

Input 9

6767676767

Output 9

691869515

Note

problem_20261_8052f36dcd28b01df7ae15fd72c90ae4.jpg

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.