All Tracks Basic Programming Bit Manipulation Basics of Bit Manipulation Problem

Lucky Numbers
Tag(s):

Easy

Problem
Editorial
Analytics

Golu wants to find out the sum of Lucky numbers.Lucky numbers are those numbers which contain exactly two set bits.This task is very diffcult for him.So Help Golu to find sum of those numbers which exactly contain two set bits upto a given number N.

3 5 10 are lucky numbers where 7 14 are not.

INPUT

First line contain number of test cases T.Each test case contains a single number N.

OUTPUT

Print sum of all Lucky Numbers upto N.Output may be large so take modulo with 1000000007.

Constraints

1<=T<=105
1<=N<=1018

NOTE: Since value of test cases and n is really large, please use fast I/O optimization techniques.

SAMPLE INPUT
1
5
SAMPLE OUTPUT
8
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

Craftsvilla

Challenge Name

Craftsvilla Backend Developer Hiring Challenge

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications

?