Universal Cup Judging System

Universal Cup

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓
Statistics

Description

You are given a positive integer $N$.

Find the number of pairs of integers $(a, b)$ such that $1 \le a, b < 2^N$ and the following condition is satisfied, modulo the prime $998244353$:

  • There exists a non-degenerate triangle whose side lengths are $a, b, a \oplus b$.

Here, for integers $x, y$, $x \oplus y$ denotes the bitwise XOR of $x$ and $y$.

Input

The first line contains an integer $N$. ($1 \le N \le 10^{18}$)

Output

Print the number of pairs of integers $(a, b)$ satisfying the condition, modulo the prime $998244353$.

Examples

Input 1

2

Output 1

0

Input 2

5

Output 2

390

Explanation

For the second example, for instance, $(a, b) = (13, 24)$ satisfies the condition. Since $a \oplus b = 13 \oplus 24 = 21$, there exists a non-degenerate triangle whose side lengths are $13, 24, 21$.

There are $390$ pairs of integers $(a, b)$ satisfying the condition.

Input 3

10000

Output 3

851087540

Hint

The bitwise XOR $x \oplus y$ of non-negative integers $x, y$ is defined as follows:

  • In the binary representation of $x \oplus y$, the digit at the $2^k$ ($k \ge 0$) place is $1$ if and only if exactly one of the digits at the $2^k$ place in the binary representations of $x$ and $y$ is $1$; otherwise, it is $0$.

For example, $3 \oplus 5 = 6$ (in binary, $011 \oplus 101 = 110$).

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#2159EditorialOpen题解AnonymousView
#1536EditorialOpen题解jianglyView

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.