Universal Cup Judging System

Universal Cup

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

Descrizione

Ti viene dato un intero positivo $N$.

Trova il numero di coppie di interi $(a, b)$ tali che $1 \le a, b < 2^N$ e sia soddisfatta la seguente condizione, modulo il numero primo $998244353$:

  • Esiste un triangolo non degenere i cui lati hanno lunghezze $a, b, a \oplus b$.

Qui, per gli interi $x, y$, $x \oplus y$ indica lo XOR bit a bit di $x$ e $y$.

Input

La prima riga contiene un intero $N$. ($1 \le N \le 10^{18}$)

Output

Stampa il numero di coppie di interi $(a, b)$ che soddisfano la condizione, modulo il numero primo $998244353$.

Esempi

Input 1

2

Output 1

0

Input 2

5

Output 2

390

Spiegazione

Per il secondo esempio, ad esempio, $(a, b) = (13, 24)$ soddisfa la condizione. Poiché $a \oplus b = 13 \oplus 24 = 21$, esiste un triangolo non degenere i cui lati hanno lunghezze $13, 24, 21$.

Ci sono $390$ coppie di interi $(a, b)$ che soddisfano la condizione.

Input 3

10000

Output 3

851087540

Suggerimento

Lo XOR bit a bit $x \oplus y$ di due interi non negativi $x, y$ è definito come segue:

  • Nella rappresentazione binaria di $x \oplus y$, la cifra nella posizione $2^k$ ($k \ge 0$) è $1$ se e solo se esattamente una delle cifre nella posizione $2^k$ nelle rappresentazioni binarie di $x$ e $y$ è $1$; altrimenti è $0$.

Ad esempio, $3 \oplus 5 = 6$ (in binario, $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.