Getting WA when submiting the code

i am getting the desired output in the stdoutbox when am running the code but when im submiting it im getting the wrong answer i dont know why here is my code…

/* package codechef; // don’t place package name! */

import java.util.;
import java.lang.
;
import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here

     long  p=0,j=0;int t=0;
	Scanner sc = new Scanner(System.in);
	if(sc.hasNext())
	 t=sc.nextInt();
	while(t!=0)
	{
	    System.out.println();
	    long s=sc.nextLong();
	    int n=sc.nextInt();
	    int k=sc.nextInt();
	    int r=sc.nextInt();
	    for(int i=0;i<n;i++)
	    {
	        s=s-(long)k;
	        k*=r;
	    }
	    if(s>0)
	    {
	    System.out.println("POSSIBLE "+s);
	    p=p+s;
	    }
	    else
	    {
	        s=s*(-1);
	        j=j+s;
	    System.out.println("IMPOSSIBLE "+s);
	    }
	    t--;
	    
	}
	if(j>p)
	System.out.println("IMPOSSIBLE");
	else
	System.out.println("POSSIBLE");
	System.out.println();
	
	
}

}

Can you provide problem link.

Share problem link or tell me the problem code