Kabir wants to impress Tara by showing her his problem solving skills. He has decided to give the correct answer to the next question which will be asked by his Algorithms teacher.
The question asked is:
Find the sum of alternate consecutive d$d$ odd numbers from the range L$L$ to R$R$ inclusive.
if d$d$ is 3 and L$L$ is 10 and R$R$ is 34, then the odd numbers between 10 and 34 are 11,13,15,17,19,21,23,25,27,29,31,33$11,13,15,17,19,21,23,25,27,29,31,33$, and the d$d$ alternate odd numbers are 11,13,15,23,25,27$11,13,15,23,25,27$.
You are a friend of Kabir, help him solve the question.
Note:$Note:$ Number of odd number between L$L$ and R$R$ (both inclusive) is a multiple of d$d$.

-----Input:-----
- First line will contain T$T$, number of test cases.  
- First line of each test case contains one integer d$d$ . 
- Second line of each test case contains two space separated integer L$L$ and R$R$.

-----Output:-----
For each test case, print the sum modulo 1000000007.

-----Constraints:-----
- 1≤T≤106$1 \leq T \leq 10^6$
- 1≤d≤103$1 \leq d \leq 10^3$
- 1≤L<R≤106$1 \leq L < R \leq 10^6$

-----Sample Input:-----
1
3 

10 33

-----Sample Output:-----
114

-----EXPLANATION:-----
Sum of alternate odd numbers i.e, 11,13,15,23,25,27 is 114

Difficulty: interview

Starter code:

Solutions:
# cook your dish here
for t in range(int(input().strip())):
    d = int(input().strip())
    L, R = map(int, input().strip().split(" "))
    if L % 2 == 0:
        L += 1
    sum = (((((R - L + 2)//2)//d)+1)//2) - 1
    sum = (sum * 2 * d * (sum + 1) * d) + (sum+1) *d * (L + d -1)
    print(sum%1000000007)

# cook your dish here
t=int(input())
while t>0 :
    d=int(input())
    l,r=map(int,input().split())
    if l%2==1 and r%2==1 :
        num=(r-l)//2+1 
    elif l%2==1 or r%2==1 :
        num=(r-l+1)//2
    else :
        num=(r-l)//2 
    if l%2==0 :
        l=l+1 
    if(num%(2*d)==0) :
        n=num//(2*d)
    else :
        n=num//(2*d)+1
    init=l*d+ d*(d-1)
    su=n*init
    su=su+2*d*d*n*(n-1)
    print(su%1000000007)
    t=t-1

# cook your dish here
def __starting_point():
    for _ in range(int(input())):
        d = int(input())
        l, r = map(int, input().split())
        if l % 2 != 0 :
            l -= 1
        if r % 2 != 0:
            r += 1
        n = (r-l)//(2*d)
        if n % 2 == 0:
            n = n//2
        else:
            n = n//2+1
        a = d*(l+d)
        f = 4*d*d
        ans = ((n*(2*a+(n-1)*f))//2)%1000000007
        print(ans)
__starting_point()