We use the integers , , and to create the following series:

You are given queries in the form of , , and . For each query, print the series corresponding to the given , , and values as a single line of space-separated integers.

Input Format

The first line contains an integer, , denoting the number of queries.
Each line of the subsequent lines contains three space-separated integers describing the respective , , and values for that query.

Constraints

Output Format

For each query, print the corresponding series on a new line. Each series must be printed in order as a single line of space-separated integers.Sample Input

2
0 2 10
5 3 5
Sample Output

2 6 14 30 62 126 254 510 1022 2046
8 14 26 50 98

Give in java code with the input and output

Here's a solution in Java that takes the input and provides the desired output:

```
import java.util.Scanner;

public class Series {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int queries = scanner.nextInt();
for (int i = 0; i < queries; i++) {
int a = scanner.nextInt();
int b = scanner.nextInt();
int n = scanner.nextInt();
calculateSeries(a, b, n);
}
scanner.close();
}

private static void calculateSeries(int a, int b, int n) {
int result = a;
for (int i = 0; i < n; i++) {
result += Math.pow(2, i) * b;
System.out.print(result + " ");
}
System.out.println();
}
}
```

Input:
```
2
0 2 10
5 3 5
```

Output:
```
2 6 14 30 62 126 254 510 1022 2046
8 14 26 50 98

Here is the Java code to solve the given problem:

```java
import java.util.Scanner;

public class SeriesGenerator {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int queries = scanner.nextInt();

// Loop through each query
for (int i = 0; i < queries; i++) {
int a = scanner.nextInt();
int b = scanner.nextInt();
int n = scanner.nextInt();

// Calculate and print the series
for (int j = 0; j < n; j++) {
int result = a;
for (int k = 0; k <= j; k++) {
result += Math.pow(2, k) * b;
}
System.out.print(result + " ");
}
System.out.println();
}

scanner.close();
}
}
```

Input:
```
2
0 2 10
5 3 5
```

Output:
```
2 6 14 30 62 126 254 510 1022 2046
8 14 26 50 98
```

Explanation:
- For the first query, the series is generated by adding the powers of 2 multiplied by `b` to the initial value `a`. The series starts with 2 and each subsequent term is obtained by adding twice the previous term plus 2. The series ends after 10 terms.
- For the second query, the series starts with 5 and each subsequent term is obtained by adding three times the previous term plus 3. The series ends after 5 terms.

Sure! Here's a Java code snippet that solves the given problem:

```java
import java.util.Scanner;

public class Series {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();

for (int i = 0; i < n; i++) {
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scanner.nextInt();
int result = a;

for (int j = 0; j < c; j++) {
result += (int) Math.pow(2, j) * b;
System.out.print(result + " ");
}

System.out.println();
}

scanner.close();
}
}
```

Explanation of the code:

1. The code takes the input values from the user using the `Scanner` class.
2. `n` represents the number of queries, so we read it from the input.
3. We then use a `for` loop to iterate over the queries. For each query, we read the values `a`, `b`, and `c`.
4. `a` represents the starting value of the series. We initialize `result` with `a`.
5. Inside the nested `for` loop, we calculate the next number in the series using the formula `result += (int) Math.pow(2, j) * b`. This formula calculates the terms of the series by multiplying `b` with the powers of 2.
6. We print each term of the series on the same line using `System.out.print(result + " ")`.
7. After printing all the terms for a query, we move to the next line using `System.out.println()`.
8. Finally, we close the `Scanner` object to release system resources.

You can run this code by providing the input as described in the problem statement and compare the output with the given sample output.