Problem Description: Perfect Sets in Number Theory
Fox Ciel studies number theory and has a particular interest in perfect sets of non-negative integers. A non-empty set ( S ) is considered perfect if and only if for any ( a, b \in S ) (where ( a ) can be equal to ( b )), the condition ( (a \text{ xor } b) \in S ) holds true. Here, the operation "xor" refers to the exclusive or operation.
Your task is to calculate the number of perfect sets consisting of integers not greater than a given integer ( k ). Since the answer may be very large, you are required to print it modulo ( 10^9 + 7 ) (1000000007).
Input Format
The first line contains a single integer ( k ) (where ( 0 \leq k \leq 10^9 )).
Output Format
Print a single integer — the number of required perfect sets, modulo ( 10^9 + 7 ).
Example Input/Output
Example 1
Input:
text
1
Output:
text
2
Example 2
Input:
text
2
Output:
text
3
Example 3
Input:
text
3
Output:
text
5
Example 4
Input:
text
4
Output:
text
6
Note
In Example 1, the perfect sets are ( {0} ) and ( {0, 1} ). The set ( {1} ) is not considered perfect because ( 1 \text{ xor } 1 = 0 ) and ( {1} ) does not include 0.
In Example 4, the perfect sets include ( {0} ), ( {0, 1} ), ( {0, 2} ), ( {0, 3} ), ( {0, 4} ), and ( {0, 1, 2, 3} ).
Implementation
Please place your solution in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.