Can anyone please Explain what is wrong in my code it is not excepted by judge but the output is correct as per the TEST CASE

#include<bits/stdc++.h>

using namespace std;

#define N 1000000007

long long int myexp(long long int base,

long long int exp)

{

if (exp == 0)

return 1;

if (exp == 1)

return base % N;

long long int t = myexp(base, exp / 2);

t = (t * t) % N;

if (exp % 2 == 0)

return t;

else

return ((base % N) * t) % N;

}

int main()

{

ios_base::sync_with_stdio(false);

cin.tie(NULL);

int t;

cin >> t;

while (t–)

{

long long int n, a;

cin >> n >> a;

long long int sum = 0;

int count = 1;

for (int i = 0; i < n; i++)

{

long long int d = (myexp(a, count)) % N;

sum += d%N ;

a *= d;

count += 2;

}

cout << sum%N << endl;

}

}