runtime error due to timeout
import java.util.*; import java.io.*; class series{ public static void main(String []args){ Scanner in = new Scanner(System.in); System.out.println(""); int q=in.nextInt(); double sum; int a=0,b=0,n=0; int i,j,k; for(int p=0;p<q;p++){ a = in.nextInt(); b = in.nextInt(); n = in.nextInt(); } in.close(); for(i=1;i<=q;i++) { for(j=1;j<=n-1;j++) { sum = 0.0; for(k=1;k<=j;j++) { sum = sum + ((Math.pow(2,k-1))*b); } System.out.println(a + sum); } System.out.println(); }}}