CF914G.Sum the Fibonacci

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given an array ss of nn non-negative integers.

A 5-tuple of integers (a,b,c,d,e)(a,b,c,d,e) is said to be valid if it satisfies the following conditions:

  • 1<=a,b,c,d,e<=n1<=a,b,c,d,e<=n
  • (sa(s_{a} | sb)s_{b}) & scs_{c} & (sd(s_{d} ^ se)=2is_{e})=2^{i} for some integer ii
  • sas_{a} & sb=0s_{b}=0

Here, '|' is the bitwise OR, '&' is the bitwise AND and '^' is the bitwise XOR operation.

Find the sum of f(saf(s_{a} | sb)f(sc)f(sds_{b})*f(s_{c})*f(s_{d} ^ se)s_{e}) over all valid 5-tuples (a,b,c,d,e)(a,b,c,d,e) , where f(i)f(i) is the ii -th Fibonnaci number ( f(0)=0,f(1)=1,f(i)=f(i1)+f(i2)f(0)=0,f(1)=1,f(i)=f(i-1)+f(i-2) ).

Since answer can be is huge output it modulo 109+710^{9}+7 .

输入格式

The first line of input contains an integer nn ( 1<=n<=1061<=n<=10^{6} ).

The second line of input contains nn integers sis_{i} ( 0<=si<2170<=s_{i}<2^{17} ).

输出格式

Output the sum as described above, modulo 109+710^{9}+7

输入输出样例

  • 输入#1

    2
    1 2
    

    输出#1

    32
    
  • 输入#2

    3
    7 4 1
    

    输出#2

    3520
    
  • 输入#3

    10
    1 3 0 7 3 7 6 5 7 5
    

    输出#3

    1235424
    
  • 输入#4

    10
    50 9 11 44 39 40 5 39 23 7
    

    输出#4

    113860062
    
首页