I am getting wrong answer in this question. Need Help.

link text

This is the link for the problem. below is my solution

enter code here
#include<iostream>

using namespace std;

#define loop(i,j,k) for( int i = j; i < k; i++)
int main()
{
int T;
cin >> T;

loop(i,0,T)
{
           long long unsigned int a, d, n, x, count, m;
           count = 0;
           m = 215372682525ll;
           cin >> a >> d >> n >> x;
           
           long long int s = 1;
           
           for (int j = n; j >= 0; j--)
           {
                  count = (count + (((a + (j * d)%m))% m) * (s % m)) % m;
                  s = (s  * x) % m;
                  
                  
                      
           }
cout << count <<endl;
           
           
}

//getchar();getchar();getchar();
return 0;

}


I request you to point out any mistake that i have doneā€¦ I will be very grateful to you