6854.Counting Grids

Time Limit: 1s Memory Limit: 512MB

Your task is to count the number of different $n \times n$ grids whose each square is black or white.

Two grids are considered to be different if it is not possible to rotate one of them so that they look the same.

Input Format(From the terminal/stdin)

The only input line has an integer $n$ : the size of the grid.

  • $1 \le n \le 10^9$

Output Format(To the terminal/stdout)

Print one integer: the number of grids modulo $10^9+7$ .

Sample Input

Copy
4
 \n

Sample Output

Copy
16456
     \n
Source: CSES, Mathematics, 2210

Submit

请先 登录

© 2025 FAQs