Xor Sum

Time Limit: 20000/10000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

sweetzero最近在学位运算,看到了一段代码:
for(int i = LA; i <= RA; i ++)
   for(int j = LB; j <= RB; j ++)
       for(int k = LC; k <= RC; k ++)
           for(int r = LD; r <= RD; r ++)
              if((i ^ j ^ k ^ r) == 0) count ++,sum += i + j + k + r;

由于sweetzero初学位运算,智商捉急,您能帮忙计算出count和sum吗?

Input

多组数据(<=5000组),每组数据一行LA,RA,LB,RB,LC,RC,LD,RD(所有数为[1,10^9]的正整数,且LA <= RA,LB <= RB,LC<=RC,LD <= RD)

Output

对于每组数据,一行输出 count % 1000000007, sum % 1000000007,两个数用一个空格隔开

Sample Input

1 1 1 1 1 1 1 1
1 10 2 11 3 12 4 13

Sample Output

1 4
680 19352

Source

sweetzero

Manager

Information
Solved Number17
Submit Number59
Problem Tags
dp
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel