题库练习 Fox and Perfect Sets
← 上一题 下一题 →

A9298 | Fox and Perfect Sets

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Fox Ciel studies number theory.

She thinks a non-empty set $S$ contains non-negative integers is perfect if and only if for any ![](/uploads/luogu/CF388D/c903e14df0afa987e9cf41a6200a241f6b8b2cd2_4a20af2b5d75.png) ( $a$ can be equal to $b$ ), ![](/uploads/acgo/image/21f43d4698a3b7c4_a9aaf1b4c173.jpeg). Where operation $xor$ means exclusive or operation (http://en.wikipedia.org/wiki/Exclusive\_or).

Please calculate the number of perfect sets consisting of integers not greater than $k$ . The answer can be very large, so print it modulo $1000000007$ $(10^{9}+7)$ .

输入格式

The first line contains an integer $k$ ( $0<=k<=10^{9}$ ).

输出格式

Print a single integer — the number of required sets modulo $1000000007$ $(10^{9}+7)$ .

输入输出样例

输入 #1
1
输出 #1
2
输入 #2
2
输出 #2
3
输入 #3
3
输出 #3
5
输入 #4
4
输出 #4
6
C++ 编辑器
输入
输出