luogu#P4317. 花神的数论题

花神的数论题

Background

As is well known, for many years Huashen has crushed various OJ, OI, CF, TC ... of course including CH.

Problem Description

One day, Huashen came to give another lecture. As usual, there was a super hard problem afterwards... We weaklings suffered again. The problem is as follows: Let sum(i)\text{sum}(i) denote the number of 11 s in the binary representation of ii. Given a positive integer NN, Huashen asks you to compute i=1Nsum(i)\prod_{i=1}^{N}\text{sum}(i), that is, the product of sum(1)sum(N)\text{sum}(1)\sim\text{sum}(N).

Input Format

A positive integer NN.

Output Format

One integer: the answer modulo 1000000710000007.

3
2

Hint

Constraints: For 100%100\% of the testdata, 1N10151 \le N \le 10^{15}.

Translated by ChatGPT 5