#P39. [KBC002F] Count 1
[KBC002F] Count 1
Source
This problem is adapted from Long Long OJ. All rights reserved.
Description
A new bitwise operation is defined as follows: , , , .
Output the number of strings of length (modulo ) that satisfy the following conditions:
- $((((A_1\sharp A_2)\sharp A_3)\sharp\cdots)\sharp A_{N-1})\sharp A_N=1$;
- $A_1\sharp(A_2\sharp(A_3\sharp(\cdots\sharp(A_{N-1}\sharp A_N))))=1$.
Input
An integer .
Output
The result modulo .
Samples
20
699051
Tips
.