H. xorpairs
time limit per test
5 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

Alex, a brilliant cryptographer, is on the verge of a major breakthrough. An ancient manuscript speaks of a lost civilization that encoded secrets using a unique numerical system. The key to their cipher lies in two fundamental concepts.

The first is the "Digital Essence" of a number, which the manuscript describes as the bitwise XOR sum of all its decimal digits. Let's call this function $$$g(x)$$$. For example, $$$g(1234) = 1 \oplus 2 \oplus 3 \oplus 4 = 4$$$, where $$$\oplus$$$ denotes the bitwise XOR operation.

The second concept is the "Mystic Range" between two numbers, say $$$a$$$ and $$$b$$$. This is the sum of the Digital Essence of every integer in the inclusive range between them. We can define this as: $$$$$$f(a, b) = \sum\limits_{i=\min(a, b)}^{\max(a, b)} g(i)$$$$$$

Alex has discovered a crucial array of numbers, $$$A$$$, which are the final keys to the cipher. The manuscript's last instruction is clear: to unlock the ultimate secret, one must calculate the Mystic Range $$$f(A_i, A_j)$$$ for every pair of numbers in the array $$$A$$$, and then find the grand total of all these results.

Since the total sum can be very large, you must output the result modulo $$$10^9 + 7$$$.

Input

The first line of input contains a single integer $$$N$$$ ($$$2 \le N \le 10^5$$$), the number of elements in the array $$$A$$$.

The second line contains $$$N$$$ space-separated integers $$$A_1, A_2, \ldots, A_N$$$ ($$$0 \le A_i \le 10^9$$$), the elements of the array.

Output

Print a single integer representing the sum $$$\sum f(A_i, A_j)$$$ modulo $$$10^9 + 7$$$.

Examples
Input
4
5 15 3 24
Output
356
Input
5
0 1000000000 0 1000000000 0
Output
758125779