**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
def II():
    return(int(input()))
def LMI():
    return(list(map(int,input().split())))
def I():
    return(input())
def MII():
    return(map(int,input().split()))
import sys
input=sys.stdin.readline
# import io,os
# input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# from collections import Counter
# int(math.log(len(L)))
# import math
# from collections import defaultdict
# mod=10**9+7
# from collections import deque
import  math

P=[False]*(2*10**7+1)
P[1]=True
prime=[1]
for i in range(2,2*10**7+1):
    if P[i]==False:
        prime.append(i)
        for j in range(i,2*10**7,i):
            P[j]=True

import bisect
final=0
# from functools import cache
# @cache
def t():
    global final
    n,m,l,f=MII()
    cc=bisect.bisect_right(prime,n)-1
    cache=set()
    def nei(a,b):
        ans=[]
        if a<n:
            if math.gcd(a+1,b)<=1:
                ans.append((a+1,b))
        if b<n and math.gcd(a,b+1)<=1:
            ans.append((a,b+1))
        return ans
    final=0
    def dfs(a,b):
        global final
        if (a,b) in cache:
            return
        cache.add((a,b))
        final=max(final,max(a,b)*max(l,f)+min(a,b)*min(l,f))
        for j in nei(a,b):
            dfs(j[0],j[1])

    if 2*prime[cc-1]>n:
        dfs(prime[cc],prime[cc-1])
    else:
        dfs(1,1)
    print(final)

    return

if __name__=="__main__":

    for _ in range(II()):
        t()
    # t()

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To expose the bug in the provided code, we need to focus on edge cases that can cause the algorithm to fail. The key points to consider are:

1. **Prime Number Handling**: The code uses a list of prime numbers to determine the starting point for the DFS. If the prime number handling is incorrect, it can lead to incorrect results.
2. **GCD Condition**: The GCD condition must be checked carefully to ensure that the performance remains successful.
3. **DFS Termination**: The DFS should terminate correctly when it reaches the maximum possible score without violating the GCD condition.

Given these points, a challenging test input could be one where the starting point for the DFS is not a prime number or where the GCD condition is critical. Here's a small-scale test input that could expose the bug:

```plaintext
3
4 4 3 2
5 5 2 3
6 6 4 1
```

Explanation:
1. **Test Case 1 (4, 4, 3, 2)**:
   - The prime numbers up to 4 are 2 and 3.
   - The DFS should start with (2, 3) or (3, 2) and check all valid moves.
   - The expected output is 14, which can be achieved by the sequence (0, 1), (1, 1), (1, 2), (2, 2), (2, 3), (3, 3), (4, 3).

2. **Test Case 2 (5, 5, 2, 3)**:
   - The prime numbers up to 5 are 2, 3, and 5.
   - The DFS should start with (3, 2) or (5, 3) and check all valid moves.
   - The expected output is 17, which can be achieved by the sequence (0, 1), (1, 1), (1, 2), (2, 2), (2, 3), (3, 3), (4, 3), (5, 3).

3. **Test Case 3 (6, 6, 4, 1)**:
   - The prime numbers up to 6 are 2, 3, and 5.
   - The DFS should start with (5, 3) or (3, 2) and check all valid moves.
   - The expected output is 24, which can be achieved by the sequence (0, 1), (1, 1), (1, 2), (2, 2), (2, 3), (3, 3), (4, 3), (5, 3), (6, 3).

This test input covers a range of values and checks the GCD condition thoroughly, which should help in exposing any bugs in the code.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main{
	private static FastReader sc = new FastReader();
	private static PrintStream out =System.out;
	private static final long mod =1000000007;
	private static int n ,m ;
	private static long l ,f ,res;

	public static void main (String[] args) throws java.lang.Exception{
		PrimeNumber pn =new PrimeNumber(20000000);
		for(int t =sc.nextInt() ;t >0 ;t--) {
			n =sc.nextInt();
			m =sc.nextInt();
			l =sc.nextLong();
			f =sc.nextLong();
			if(l <f) { l^=f; f ^=l; l ^=f;}
			int mxp =pn.binarys(n);
			res =n *l +f;
			//dfs(pn.arr.get(mxp) ,pn.arr.get(mxp -1));
			for(int e =pn.arr.get(mxp) ,g =0;e <=n ;e++ ,g =0) {
				for(g =pn.arr.get(mxp -1) ;gcd(e ,g) <=1 && g <n ;g++) {}
				res =Math.max(res, e *l +(g -1) *f);
			}
			out.println(res);

		}
	}
	private static int gcd(int x ,int y) {
		return (y ==0) ?x :gcd(y ,x %y);
	}
	private static void dfs(int a ,int b) {
		//out.println(a +" "+ b +" " +gcd(a +1 ,b) +" " +gcd(a ,b +1));
		res =Math.max(res ,l *a +f *b);
		if(gcd(a ,b +1) <=1 && b <m) dfs(a ,b +1);
		if(gcd(a +1,b) <=1 && a <n) dfs(a +1,b);
	}
}
class PrimeNumber{
	ArrayList<Integer> arr;
	PrimeNumber(int n){
		boolean flag[] =new boolean[n +1];
		arr =new ArrayList();
		arr.add(0);
		arr.add(1);
		for(int e =2 ;e <=n ;e++) {
			if(flag[e] ==false) {
				arr.add(e);
				for(int f =e ;f <=n ;f+=e) flag[f] =true;
			}
		}
	}
	public int binarys(int val) {
		int fr =1 ,ls =arr.size() -1 ,res =0;
		while(fr <=ls) {
			int mid =(fr +ls)>>1;
			if(arr.get(mid) <=val) {
				res =mid;
				fr =mid +1;
			}else {
				ls =mid -1;
			}
		}
		return res;
	}
}

class FastReader {
	BufferedReader br;
	StringTokenizer st;

	public FastReader() {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	String next() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}

	String nextLine() {
		String str = "";
		try {
			if (st.hasMoreTokens()) {
				str = st.nextToken("\n");
			} else {
				str = br.readLine();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return str;
	}
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the given buggy code, we need to consider edge cases and scenarios that are likely to cause the algorithm to fail. The key aspects to focus on include:

1. **Edge Cases for `n` and `m`**: Since `n = m`, we need to consider small values of `n` where the behavior of the algorithm can be more easily observed.
2. **Values of `l` and `f`**: These values can significantly affect the outcome, especially when `l` and `f` are close to each other or when one is significantly larger than the other.
3. **GCD Conditions**: The algorithm must ensure that the GCD condition is always met, so we should test cases where the GCD condition is more likely to be violated.

Given these considerations, let's construct a small-scale test input that includes these aspects:

```plaintext
3
3 3 1 2
4 4 2 1
5 5 3 3
```

### Explanation:

1. **Test Case 1: `n = 3, m = 3, l = 1, f = 2`**
   - This test case is simple and small, making it easy to verify the algorithm's behavior.
   - The values of `l` and `f` are different, which can help in testing the logic for maximizing the score while ensuring the GCD condition is met.

2. **Test Case 2: `n = 4, m = 4, l = 2, f = 1`**
   - This test case is slightly larger, but still manageable.
   - The values of `l` and `f` are swapped compared to the first test case, which can help in testing the algorithm's handling of different weightings.

3. **Test Case 3: `n = 5, m = 5, l = 3, f = 3`**
   - This test case is larger and includes equal values for `l` and `f`.
   - This can help in testing the algorithm's handling of equal weightings, which can be a tricky scenario for the GCD condition.

These test cases are designed to cover a range of scenarios and help expose any bugs in the algorithm, particularly those related to the GCD condition and the maximization of the score.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
import java.util.*;

public class ques {

    public static int gcd(int a, int b) {
        if (a < b) {
            int temp = a;
            a = b;
            b = temp;
        }
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static int f(int[][] dp, int l, int r, int n) {

        int fl = 0;
        int ans = 0;
        if (n > 100) {
            fl = n - 100;
        }
        for (int i = fl; i < n + 1; i++) {
            for (int j = fl; j < n + 1; j++) {
                if (i == fl || j == fl) {
                    dp[i - fl][j - fl] = 1;
                } else if (gcd(i, j) == 1) {
                    if (i - fl - 1 >= 0 && j - fl >= 0) {
                        dp[i - fl][j - fl] = dp[i - fl - 1][j - fl];
                    }
                    if (i - fl >= 0 && j - fl - 1 >= 0) {
                        dp[i - fl][j - fl] |= dp[i - fl][j - fl - 1];
                    }
                }
                if (dp[i - fl][j - fl] == 1) {
                    ans = Math.max(ans, l * i + j * r);
                }
            }
        }

        return ans;
    }

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();

        while (t-- > 0) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int l = sc.nextInt();
            int r = sc.nextInt();
            int[][] dp = new int[101][101];
            for (int[] x : dp) {
                Arrays.fill(x, 0);
            }

            System.out.println(f(dp, l, r, n));
        }

        sc.close();
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
2 2 1 1
3 3 1 1
4 4 1 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define FOR(i,x,n) for(int i = x; i<=n; i++)
#define FORO(i,n) for(int i = 0; i<n; i++)
#define ROF(i,x,n) for(int i = x; i>=n; i--)
#define nl "\n"
#define sp " "
#define pb push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vpi vector<pair<int, int>>
#define vpl vector<pair<ll, ll>>
#define PQ priority_queue
#define pi pair<int, int>
#define pl pair<ll, ll>
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define agus int t;cin>>t; FOR(i,1,t)
#define ishowspeed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define NO cout<<"NO\n"
#define YES cout<<"YES\n"
#define lll __int128
#define sais size
#define saisof sizeof
#define ld long double

//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

const ll INF = 1e18+5;
const int MOD = 1e9+7;
const int SQ = 707, MX = 1e5+5;

ll n,m,l,f,lp[20000005],num,ans;
bool isntP[20000005], kuli[105][105];
vl p;

void go(int a, int b){
    if(a > b) swap(a,b);
    if(kuli[a][b]) return;
    kuli[a][b] = 1;
    ans = max(ans, (num+a)*l+(num+b)*f);
    if(num+b == n) return;
    if(__gcd(num+a,num+b+1) == 1) go(a,b+1);
    if(__gcd(num+a+1,num+b) == 1) go(a+1,b);
    return;
}

void sol(int tc){
	cin>>n>>m>>l>>f;
    if(l > f) swap(l,f);
	if(n == 4){
		cout<<max(n*max(l,f)+min(l,f), max(l,f)*3+min(l,f)*2)<<nl;
		return;
	}
	int id = ub(all(p),n)-p.begin();
	id--;
	if(p[id] == n){
		cout<<n*f+(n-1)*l<<nl;
		return;
	}
	ans = p[id]*f+(p[id]-1)*l;
    memset(kuli,0,sizeof kuli);
	num = p[id-1];
    go(0,p[id]-num);
	cout<<ans<<nl;
}

signed main(){
	ishowspeed
    p.pb(1);
	for(ll i = 2; i <= 20000000; i++){
		if(isntP[i]) continue;
		p.pb(i);
		for(ll j = i*i; j <= 20000000; j+=i) isntP[j] = 1;
	}
	FORO(i,p.size()){
		for(int j = p[i]+p[i]; j <= 20000000; j+=p[i]) if(!lp[j]) lp[j] = p[i];
	}
	agus
	sol(0);
	return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided buggy code, we need to focus on edge cases and scenarios that are likely to cause the code to fail. Here are the steps to think through the problem:

1. **Edge Cases for \( n \) and \( m \):**
   - Since \( n = m \), we need to consider values where the code might not handle the constraints correctly.
   - Values close to the upper limit (20,000,000) can be challenging due to the complexity of the algorithm.
   - Small values (like 2, 3, 4) can also expose bugs in the base cases.

2. **Values of \( l \) and \( f \):**
   - The values of \( l \) and \( f \) can significantly affect the outcome. Large values can test the limits of the score calculation.
   - Values where \( l \) and \( f \) are close or very different can also be interesting.

3. **Prime Numbers and Composites:**
   - The code seems to use prime numbers in its logic. Testing with prime numbers and composite numbers can help expose issues.
   - Specifically, testing with a prime number close to the upper limit and a composite number can be useful.

4. **Multiple Test Cases:**
   - Including multiple test cases can ensure that the code is robust and handles different scenarios.

Given these considerations, a small-scale test input that is complete and valid is:

```plaintext
3
2 2 1 1
4 4 1 1
7 7 10 1
```

### Explanation:
1. **Test Case 1: \( n = 2, m = 2, l = 1, f = 1 \)**
   - This is a small case that tests the base condition.
   - The expected output is 3, as the maximum score can be achieved by one win for Lelle and one win for Flamm.

2. **Test Case 2: \( n = 4, m = 4, l = 1, f = 1 \)**
   - This is a small case where the code has a special handling for \( n = 4 \).
   - The expected output is 7, as the maximum score can be achieved by three wins for one and one win for the other.

3. **Test Case 3: \( n = 7, m = 7, l = 10, f = 1 \)**
   - This case tests the code with a larger value of \( l \) and a smaller value of \( f \).
   - The expected output is 61, as the maximum score can be achieved by six wins for Lelle and one win for Flamm.

This test input should help expose any bugs in the provided code by covering a range of scenarios from small to larger values and different combinations of \( l \) and \( f \).


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/trie_policy.hpp>
// #include <ext/rope>

using namespace std;
// using namespace __gnu_cxx;
// using namespace __gnu_pbds;

void Hollwo_Pelw();

signed main(){
#ifndef hollwo_pelw_local
	if (fopen(".inp", "r"))
		assert(freopen(".inp", "r", stdin)), assert(freopen(".out", "w", stdout));
#else
	using namespace chrono;
	auto start = steady_clock::now();
#endif
	cin.tie(0), cout.tie(0) -> sync_with_stdio(0);
	int testcases = 1;
	cin >> testcases;
	for (int test = 1; test <= testcases; test++){
		// cout << "Case #" << test << ": ";
		Hollwo_Pelw();
	}
#ifdef hollwo_pelw_local
	auto end = steady_clock::now();
	cout << "\nExecution time : " << duration_cast<milliseconds> (end - start).count() << "[ms]" << endl;
#endif
}

/*
1 1
1 2
1 3
1 4
1 5
1 6
1 7
*/

const int N = 2e7 + 5;

int n, m, l, f, p[N];
long long res;

struct __init__ {
	__init__() {
		for (int i = 1; i < N; i++) p[i] = i;

		for (int i = 2; i < N; i++) if (p[i] == i) {
			for (long long j = 1ll * i * i; j < N; j += i) p[j] = i;
		}
	}
} __init__;

set<pair<int, int>> st;

void dfs(int a, int b) {
	st.insert({a, b});
	res = max(res, 1ll * a * l + 1ll * b * f);

	if (!st.count({a + 1, b}) && a + 1 <= n && __gcd(a + 1, b) == 1) {
		dfs(a + 1, b);
	}
	if (!st.count({a, b + 1}) && b + 1 <= m && __gcd(a, b + 1) == 1) {
		dfs(a, b + 1);
	}
}

void Hollwo_Pelw(){
	cin >> n >> m >> l >> f;

	vector<int> pr;
	for (int i = n; i >= 1; i--) {
		if (!pr.empty() && i < pr[0] - 180) break;
		if (p[i] == i) {
			pr.push_back(i);
		}
	}

	if (l < f) swap(l, f), swap(n, m);
	st.clear();

	res = pr[0] * l + (pr[0] - 1) * f;

	if (n <= 210 && m <= 210) {
		dfs(2, 1);

		cout << res << '\n';
		return ;
	}

	dfs(pr[0] + 1, pr[1]);
	dfs(pr[0], pr[0] - 156);

	cout << res << '\n';
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To create a test input that exposes the bug in the given buggy code, we need to focus on edge cases or scenarios that can maximize the failure probability. The key aspects to consider are:

1. **Constraints and Edge Cases**: The code handles specific constraints and edge cases, such as when \( n \) and \( m \) are small or when the values of \( l \) and \( f \) are very different.
2. **GCD Condition**: The code needs to ensure that the GCD condition is met after every round.
3. **Optimization**: The code aims to maximize the score, so we need to test scenarios where the optimal solution is not straightforward.

Given these points, let's construct a test input:

1. **Small \( n \) and \( m \)**: Test the behavior when \( n \) and \( m \) are small, which might expose issues in the DFS logic.
2. **Large \( n \) and \( m \)**: Test the behavior with large values of \( n \) and \( m \), which can stress the code's performance and correctness.
3. **Different \( l \) and \( f \)**: Test with different values of \( l \) and \( f \) to ensure the code handles the optimization correctly.

Here is a small-scale test input that covers these scenarios:

```plaintext
3
2 2 1 4
3 3 2 5
10 10 3 7
```

### Explanation:
1. **Test Case 1: \( n = 2 \), \( m = 2 \), \( l = 1 \), \( f = 4 \)**
   - This is a very small case where the optimal solution is straightforward.
   - The maximum score can be achieved by Flamm winning both rounds.
   - Expected output: \( 4 \cdot 2 = 8 \).

2. **Test Case 2: \( n = 3 \), \( m = 3 \), \( l = 2 \), \( f = 5 \)**
   - This is a small case that requires careful handling of the GCD condition.
   - The optimal solution involves a mix of Lelle and Flamm wins.
   - Expected output: \( 2 \cdot 2 + 5 \cdot 3 = 19 \).

3. **Test Case 3: \( n = 10 \), \( m = 10 \), \( l = 3 \), \( f = 7 \)**
   - This is a larger case that can stress the code's performance and correctness.
   - The optimal solution involves a more complex sequence of wins.
   - Expected output: A value that maximizes the score while maintaining the GCD condition.

This test input should help expose any issues in the buggy code, particularly in handling small and large values of \( n \) and \( m \), and in optimizing the score.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<utility>
#include<numeric>
using namespace std;
typedef long long ll;
const int maxn = 20000005;
map<pair<int, int>, bool> m;
vector<int> lp(maxn), p(maxn, 1);
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    for(int i = 2; i < maxn; i++){
        if(p[i]){
            lp[i] = i;
            for(int j = i + i; j < maxn; j += i) p[j] = 0;
        }
        else lp[i] = lp[i - 1];
    }
    while(t--){
        int n, m, l, f;
        cin >> n >> m >> l >> f;
        if(l < f) swap(l, f);
        if(n == 2){
            cout << 2 * l + f << "\n";
            continue;
        }
        int p = lp[n];
        int q = lp[p - 1];
        if(n <= 6) p = 1, q = 1;
        vector<vector<bool>> dp(n - p + 1, vector<bool>(n - q + 1));
        for(int i = 0; i <= n - p; i++) dp[i][0] = 1;
        for(int i = 0; i < p - q; i++) dp[0][i] = 1;
        for(int i = 1; i <= n - p; i++){
            for(int j = 1; j + q <= i + p; j++){
                if(dp[i - 1][j] || dp[i][j - 1]){
                    if(gcd(i + p, j + q) == 1) dp[i][j] = 1;
                    else dp[i][j] = 0;
                }
                else dp[i][j] = 0;
            }
        }
        ll ans = 0;
        for(int i = 0; i <= n - p; i++) for(int j = 0; j <= n - q; j++) if(dp[i][j]) ans = max(ans, 1ll * (i + p) * l + 1ll * f * (j + q));
        cout << ans << "\n";
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To expose the bug in the given buggy code, we need to focus on edge cases and scenarios that can challenge the assumptions and logic in the code. Here are some considerations:

1. **Small Values of \( n \) and \( m \)**: The code has a special case for \( n = 2 \). We should test with \( n = 3 \) and \( n = 4 \) to ensure the logic for small values works correctly.
2. **Prime Values of \( n \)**: The code uses the largest prime less than or equal to \( n \). Testing with prime values of \( n \) can help verify if the prime selection logic is correct.
3. **High Values of \( l \) and \( f \)**: Testing with high values of \( l \) and \( f \) can expose issues in the dynamic programming (DP) array and the calculation of the final score.
4. **Equal Values of \( l \) and \( f \)**: Testing with \( l = f \) can help ensure the code handles this symmetry correctly.

Given these considerations, let's create a small-scale test input that includes these scenarios:

```plaintext
4
3 3 2 5
4 4 1 4
5 5 1 4
7 7 2 3
```

This test input includes:
- \( n = 3 \) and \( n = 4 \) to test small values.
- \( n = 5 \) and \( n = 7 \) to test prime values.
- Different combinations of \( l \) and \( f \) to ensure the code handles different scoring weights correctly.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 22000000
int p[N],n,m,v[N],up=2.1e7,tot,a[505][505];
signed main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    for(int i=2;i<=up;++i){
        if(!v[i])p[++tot]=i;
        for(int j=1;j<=tot&&i*p[j]<=up;++j){
            v[i*p[j]]=1;
            if(i%p[j]==0)break;
        }
    }
    int t;cin>>t;
    while(t--){
        int n,m,wl,wf;cin>>n>>m>>wl>>wf;
        if(wl<wf)swap(n,m),swap(wl,wf);
        if(n<=30){
            int res=0;
            for(int i=0;i<=n;++i)for(int j=0;j<=n;++j)a[i][j]=__gcd(i,j)<=1;
            for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)if(a[i][j]){
                a[i][j]&=(a[i-1][j]|a[i][j-1]);
            }
            for(int i=0;i<=n;++i)for(int j=0;j<=n;++j)if(a[i][j])res=max(res,i*wl+j*wf);
            cout<<res<<"\n";continue;
        }
        int res=0;
        int x=upper_bound(p+1,p+tot+1,n)-p-1;
        for(int i=p[x];i<=n;++i)for(int j=p[x-1];j<=n;++j)a[i-p[x]][j-p[x-1]]=(__gcd(i,j)<=1);
        for(int i=1;i<=n-p[x];++i)for(int j=1;j<=n-p[x-1];++j){
            a[i][j]&=(a[i-1][j]|a[i][j-1]);
        }
        for(int i=0;i<=n-p[x];++i)for(int j=0;j<=n-p[x-1];++j)if(a[i][j])res=max(res,(i+p[x])*wl+(j+p[x-1])*wf);
        cout<<res<<"\n";
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
30 30 1 100
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
import sys
import heapq
import random
import math
from collections import deque
from itertools import *
input = sys.stdin.readline
#print = sys.stdout.write
def fg():
    return int(input())
def fgh():
    return [int(xx) for xx in input().split()]
def tt():
    sys.stdout.flush()
def sd():
    print('Yes')
def df():
    print('No')
def rec(x, y):
    global ans
    ans = max(ans, x * l + y * f)
    if math.gcd(x + 1, y) == 1 and x + 1 <= n and (x + 1, y) not in d:
        rec(x + 1, y)
        d[(x + 1, y)] = 1
    if math.gcd(x, y + 1) == 1 and y + 1 <= n and (x, y + 1) not in d:
        rec(x, y + 1)
        d[(x, y + 1)] = 1
G = 2 * 10 ** 7 + 3
p = [1] * G
for i in range(2, G):
    for j in range(i * i, G, i):
        p[j] = 0
F = [2] * G
for i in range(3, G):
    if p[i]:
        F[i] = i
    else:
        F[i] = F[i - 1]
for __ in range(fg()):
    n, m, l, f = fgh()
    if l > f:
        l, f = f, l
    p = F[n]
    ans = (p - 1) * l + p * f
    d = {}
    for j in range(p - 1, F[p - 1] - 2, -1):
        rec(j, p)
    print(ans)

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 3 1000000000 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
import math
sieve = [1]*(2*10**7+2)
primes = []
bound = [0]*(2*10**7+2)
for i in range(2,2*10**7+2):
    if sieve[i] == 1:
        for j in range(i,2*10**7+2,i):
            sieve[j] = i
        primes.append(i)
    bound[i] = primes[-1]
# 1e3 * 1e4

for _ in range(int(input())):
    n,m,l,f = map(int,input().split())
    if n<10:
        dp = [[0]*(n+1) for i in range(n+1)]
        dp[1][1] = 1
        ans = 0
        for i in range(1,n+1):
            for j in range(i+1,n+1):
                if math.gcd(i,j)==1:
                    dp[i][j] += max(dp[i-1][j],dp[i][j-1])
                    if dp[i][j] == 1:
                        ans = max(ans,i*l+j*f,i*f+j*l)
        print(ans)
    else:
        a = bound[n]
        b = bound[a-1]
        # a <= i <= n
        # b <= j <= n
        dp = [[0]*(n+2-b) for i in range(n+2-a)]
        dp[0][0] = 1
        ans = 0
        for i in range(a,n+1):
            for j in range(b,n+1):
                if math.gcd(i,j) == 1:
                    dp[i-a][j-b] += max(dp[i-1-a][j-b],dp[i-a][j-1-b])
                    if dp[i-a][j-b] == 1:
                        ans = max(ans,i*l+j*f,i*f+j*l)
        print(ans)

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
5 5 1 4
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
#include <bits/stdc++.h>
#include <iostream>
//
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_update

#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define rep(i, a, b) for (int i = a; i < (b); ++i)
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
using cd = complex<double>;
const double PI = acos(-1);

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tree<
    int,
    null_type,
    less<int>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    ordered_set;

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        // http://x...content-available-to-author-only...i.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

uniform_int_distribution<int> RAND(0, 1), COIN(0, 1), RAND2(2, 10);
uniform_real_distribution<double> R(0, 1);

using namespace std;

const int LIM = 2e7 + 10;
const int S = 4500;
bitset<LIM> isPrime;
vi eratosthenes()
{
    const int R = LIM / 2;
    vi pr = {2}, sieve(S + 1);
    pr.reserve(int(LIM / log(LIM) * 1.1));
    vector<pii> cp;
    for (int i = 3; i <= S; i += 2)
        if (!sieve[i])
        {
            cp.push_back({i, i * i / 2});
            for (int j = i * i; j <= S; j += 2 * i)
                sieve[j] = 1;
        }
    for (int L = 1; L <= R; L += S)
    {
        array<bool, S> block{};
        for (auto &[p, idx] : cp)
            for (int i = idx; i < S + L; idx = (i += p))
                block[i - L] = 1;
        rep(i, 0, min(S, R - L)) if (!block[i]) pr.push_back((L + i) * 2 + 1);
    }
    for (int i : pr)
        isPrime[i] = 1;
    return pr;
}
const int K = 300;
ll memo[K][K];
ll solve(int x, int y, int n, ll l, ll f)
{
    memset(memo, 0, sizeof memo);

    queue<vi> q;
    q.push({x, y});
    while (!q.empty())
    {
        vi cur = q.front();
        q.pop();
        vi nxt1 = {cur[0] + 1, cur[1]};
        vi nxt2 = {cur[0], cur[1] + 1};
        if (gcd(nxt1[0], nxt1[1]) <= 1 && nxt1[0] <= n && nxt1[1] <= n)
        {
            if (memo[n - nxt1[0]][n - nxt1[1]] == 0)

            {
                memo[n - nxt1[0]][n - nxt1[1]] = 1;
                q.push(nxt1);
            }
        }
        if (gcd(nxt2[0], nxt2[1]) <= 1 && nxt2[0] <= n && nxt2[1] <= n)
        {
            if (memo[n - nxt2[0]][n - nxt2[1]] == 0)

            {
                memo[n - nxt2[0]][n - nxt2[1]] = 1;
                q.push(nxt2);
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < K; i++)
    {
        for (int j = 0; j < K; j++)
        {
            if (memo[i][j])
            {
                ans = max(ans, l * (n - i) + f * (n - j));
                ans = max(ans, f * (n - i) + l * (n - j));
            }
        }
    }

    return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    eratosthenes();
    vi primes;
    for (int i = 2; i < LIM; i++)
    {
        if (isPrime[i])
            primes.push_back(i);
    }
    int tc;
    cin >> tc;
    while (tc--)
    {
        int n, m, l, f;
        cin >> n >> m >> l >> f;
        ll ans;
        if (n <= 20)
        {
            ans = solve(0, 0, n, l, f);
        }
        else
        {
            auto me = upper_bound(all(primes), n);
            me--;
            int p1 = *me;
            me--;
            int p2 = *me;
            me--;
            int p3 = *me;
            ans = solve(max(0, p2 - 200), p2, n, l, f);
        }
        cout << ans << "\n";
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the buggy code, we need to focus on edge cases and scenarios that can cause the algorithm to fail. The main issues in the buggy code include:

1. **Incorrect handling of large values of `n`**: The code uses a fixed size for the memoization table, which can lead to incorrect results for larger values of `n`.
2. **Prime number handling**: The code uses a fixed number of primes and might not handle cases where the upper bound is not a prime number correctly.

Given these points, we can construct a test case that:

- Uses a value of `n` that is just above the limit where the memoization table is defined (i.e., `K`).
- Uses values of `l` and `f` that create a significant difference in the score to highlight any issues in the score calculation.
- Ensures that the values of `n` and `m` are not prime numbers to test the prime number handling logic.

Here is a small-scale test input that meets these criteria:

```plaintext
1
200 200 1000000000 1
```

This test case:
- Uses `n = 200` and `m = 200`, which is just above the limit of the memoization table size `K = 300`.
- Uses `l = 1000000000` and `f = 1` to create a significant difference in the score calculation, which can help expose any issues in the score maximization logic.
- Ensures that `n` and `m` are not prime numbers, which can test the prime number handling logic.

This test case should help identify the bugs in the buggy code.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <array>

using namespace std;
const char el = '\n', sp = ' ';
using ll = long long;
using ld = long double;

vector<ll> primes = { 1, 2 };
ll gcd(ll a, ll b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

unordered_map<ll, char> used;
ll dfs(ll a, ll b, ll l, ll f, ll n) {
	if (used.find(a + (b << 25)) != used.end()) return 0ll;
	if (a >= b || b > n) return 0ll;
	if (gcd(a, b) > 1) return 0ll;
	used[a + (b << 25)] = true;
	ll tmp = a * l + b * f;
	//cout << a << sp << b << sp << tmp << el;
	tmp = max(tmp, dfs(a + 1, b, l, f, n));
	tmp = max(tmp, dfs(a, b + 1, l, f, n));
	return tmp;
}

void solve() {
	ll n, m, l, f;
	cin >> n >> m >> l >> f;
	if (l > f) swap(l, f);

	int lb = 1, rb = primes.size();
	while (rb - lb > 1) {
		int mb = (lb + rb) >> 1;
		if (primes[mb] > n) rb = mb;
		else lb = mb;
	}
	ll fst = primes[lb], snd = primes[lb - 1];
	ll mx = max(fst * (f + l) - l, n * f + l);

	used.clear();
	mx = max(mx, dfs(snd, fst, l, f, n));
	mx = max(mx, dfs(1, n, l, f, n));

	cout << mx << el;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//cout.precision(24);

	vector<char> sieve(20000011);
	for (int i = 3; i <= 2e7; i+=2) {
		if (!sieve[i]) {
			primes.push_back(i);
			for (ll j = (ll)i * i; j <= 2e7; j += (i << 1ll)) sieve[j] = true;
		}
	}
	int q;
	cin >> q;
	while (q--) solve();
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 3 1 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
import sys
input = sys.stdin.buffer.readline

def gcd(a,b):
    if a==0:
        return b
    if b==0:
        return a
    if a > b:
        a, b=b,a
    if b % a==0:
        return a
    return gcd(b % a,a)
def is_prime(n):
    """returns True if n is prime else False"""
    if n < 5 or n & 1 == 0 or n % 3 == 0:
        return 2 <= n <= 3
    s = ((n - 1) & (1 - n)).bit_length() - 1
    d = n >> s
    for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
        p = pow(a, d, n)
        if p == 1 or p == n - 1 or a % n == 0:
            continue
        for _ in range(s):
            p = (p * p) % n
            if p == n - 1:
                break
        else:
            return False
    return True

def process(n,m,l,f):
    answer = max(l*1+f*m, l*n+f*1)
    primes =[]
    for i in range(n,1,-1):
        if is_prime(i):
            primes.append(i)
            if len(primes) > 5:
                break
    for p1 in primes:
        for p2 in primes:
            if n >=  p1 > p2 and 2*p2-1 >= p1:
                start = [(p1, p2)]
                while len(start) >0:
                    next_s = set([])
                    for x, y in start:
                        answer = max(answer,l*x+f*y, l*y+f*x)
                        if gcd(x, y+1)==1 and y+1 <=n:
                            next_s.add((x, y+1))
                        if gcd(x+1,y)==1 and x+1 <=n:
                            next_s.add((x+1,y))
                    start = next_s
    print(answer)
def process1(n,m,l,f):
    answer =0
    S = [(0,0)]
    while len(S) > 0:
        next_s = set([])
        for x,y in S:
            answer = max(answer, l*x+f*y)
            if gcd(x+1,y)==1 and x+1 <=n:
                next_s.add(tuple(sorted([x+1,y])))
            if gcd(x,y+1)==1 and y+1 <= m:
                next_s.add(tuple(sorted([x,y+1])))
        S = next_s
        print(len(S))
    print(answer)

t = int(input())
for i in range(t):
    n, m, l, f = [int(x) for x in input().split()]
    process(n,m,l,f)

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
3 3 1000000000 1
3 3 1 1000000000
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main{
	private static FastReader sc = new FastReader();
	private static PrintStream out =System.out;
	private static final long mod =1000000007;
	private static int n ,m ;
	private static long l ,f ,res;

	public static void main (String[] args) throws java.lang.Exception{
		PrimeNumber pn =new PrimeNumber(20000000);
		for(int t =sc.nextInt() ;t >0 ;t--) {
			n =sc.nextInt();
			m =sc.nextInt();
			l =sc.nextLong();
			f =sc.nextLong();
			if(l <f) { l^=f; f ^=l; l ^=f;}
			int mxp =pn.binarys(n);
			res =n *l +f;
			dfs(pn.arr.get(mxp) ,pn.arr.get(mxp -1));
			out.println(res);
		}
	}
	private static int gcd(int x ,int y) {
		return (y ==0) ?x :gcd(y ,x %y);
	}
	private static void dfs(int a ,int b) {
		//out.println(a +" "+ b +" " +gcd(a +1 ,b) +" " +gcd(a ,b +1));
		res =Math.max(res ,l *a +f *b);
		if(gcd(a ,b +1) <=1 && b <m) dfs(a ,b +1);
		if(gcd(a +1,b) <=1 && a <n) dfs(a +1,b);
	}
}
class PrimeNumber{
	ArrayList<Integer> arr;
	PrimeNumber(int n){
		boolean flag[] =new boolean[n +1];
		arr =new ArrayList();
		arr.add(0);
		arr.add(1);
		for(int e =2 ;e <=n ;e++) {
			if(flag[e] ==false) {
				arr.add(e);
				for(int f =e ;f <=n ;f+=e) flag[f] =true;
			}
		}
	}
	public int binarys(int val) {
		int fr =1 ,ls =arr.size() -1 ,res =0;
		while(fr <=ls) {
			int mid =(fr +ls)>>1;
			if(arr.get(mid) <=val) {
				res =mid;
				fr =mid +1;
			}else {
				ls =mid -1;
			}
		}
		return res;
	}
}
class FastReader {
	BufferedReader br;
	StringTokenizer st;

	public FastReader() {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	String next() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}

	String nextLine() {
		String str = "";
		try {
			if (st.hasMoreTokens()) {
				str = st.nextToken("\n");
			} else {
				str = br.readLine();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return str;
	}
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To create a challenging test input that exposes the bug in the provided code, let's consider the following aspects:

1. **Edge Cases:**
   - **Small Values:** Test with small values of \( n \) and \( m \) to ensure the algorithm handles base cases correctly.
   - **Equal Values:** Since \( n = m \), we need to ensure the algorithm works for these specific constraints.
   - **Large Values:** Test with large values of \( n \) and \( m \) to ensure the algorithm handles large inputs efficiently.
   - **Special Values:** Test with values of \( l \) and \( f \) that are close to each other or significantly different to check the algorithm's handling of different scoring scenarios.

2. **Constraints:**
   - \( 2 \leq n = m \leq 2 \cdot 10^7 \)
   - \( 1 \leq l, f \leq 10^9 \)

3. **Expected Behavior:**
   - The algorithm should maximize the score while ensuring that \(\gcd(W_L, W_F) \leq 1\) after every round.
   - The algorithm should handle the transition between different values of \( W_L \) and \( W_F \) correctly.

Given these considerations, a small-scale test input that can expose potential issues in the buggy code is:

```plaintext
3
3 3 2 5
4 4 1 4
5 5 1 4
```

### Explanation:
1. **Test Case 1:**
   - \( n = m = 3 \)
   - \( l = 2 \)
   - \( f = 5 \)
   - This test case checks if the algorithm can handle a small \( n \) and \( m \) where \( l < f \).

2. **Test Case 2:**
   - \( n = m = 4 \)
   - \( l = 1 \)
   - \( f = 4 \)
   - This test case checks if the algorithm can handle a small \( n \) and \( m \) where \( l \) and \( f \) are significantly different.

3. **Test Case 3:**
   - \( n = m = 5 \)
   - \( l = 1 \)
   - \( f = 4 \)
   - This test case checks if the algorithm can handle a small \( n \) and \( m \) where \( l \) and \( f \) are close to each other.

These test cases are designed to cover different scenarios and should help identify any issues in the provided code.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
import sys
input = sys.stdin.buffer.readline

def gcd(a,b):
    if a==0:
        return b
    if b==0:
        return a
    if a > b:
        a, b=b,a
    if b % a==0:
        return a
    return gcd(b % a,a)
def is_prime(n):
    """returns True if n is prime else False"""
    if n < 5 or n & 1 == 0 or n % 3 == 0:
        return 2 <= n <= 3
    s = ((n - 1) & (1 - n)).bit_length() - 1
    d = n >> s
    for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
        p = pow(a, d, n)
        if p == 1 or p == n - 1 or a % n == 0:
            continue
        for _ in range(s):
            p = (p * p) % n
            if p == n - 1:
                break
        else:
            return False
    return True

def process(n,m,l,f):
    answer = max(l*1+f*m, l*n+f*1)
    primes =[]
    for i in range(n,1,-1):
        if is_prime(i):
            primes.append(i)
            if len(primes) >=2:
                break
    start = set([])
    seen = set([])
    if len(primes)==1:
        print(answer)
        return
    for p1 in primes:
        for p2 in primes:
            if n >=  p1 > p2 and 2*p2-1 >= p1:
                start.add((p1, p2))
                seen.add((p1,p2))

    while len(start) >0:
        next_s = set([])
        for x, y in start:
            answer = max(answer,l*x+f*y, l*y+f*x)
            if gcd(x, y+1)==1 and y+1 <=n and (x, y+1) not in seen:
                next_s.add((x, y+1))
                seen.add((x,y+1))
            if gcd(x+1,y)==1 and x+1 <=n and (x+1, y) not in seen:
                next_s.add((x+1,y))
                seen.add((x+1,y))
        start = next_s
    print(answer)
def process1(n,m,l,f):
    answer =0
    S = [(0,0)]
    while len(S) > 0:
        next_s = set([])
        for x,y in S:
            answer = max(answer, l*x+f*y)
            if gcd(x+1,y)==1 and x+1 <=n:
                next_s.add(tuple(sorted([x+1,y])))
            if gcd(x,y+1)==1 and y+1 <= m:
                next_s.add(tuple(sorted([x,y+1])))
        S = next_s
        print(len(S))
    print(answer)

t = int(input())
for i in range(t):
    n, m, l, f = [int(x) for x in input().split()]
    process(n,m,l,f)

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
2
3 3 2 5
4 4 1 4
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Court Blue (Easy Version)
time_limit_ms: 3000
memory_limit_mb: 512
Description: This is the easy version of the problem. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the problem are solved.

In the court of the Blue King, Lelle and Flamm are having a performance match. The match consists of several rounds. In each round, either Lelle or Flamm wins.

Let $W_L$ and $W_F$ denote the number of wins of Lelle and Flamm, respectively. The Blue King considers a match to be successful if and only if:

  * after every round, $\gcd(W_L,W_F)\le 1$;    * at the end of the match, $W_L\le n, W_F\le m$.

Note that $\gcd(0,x)=\gcd(x,0)=x$ for every non-negative integer $x$.

Lelle and Flamm can decide to stop the match whenever they want, and the final score of the performance is $l \cdot W_L + f \cdot W_F$.

Please help Lelle and Flamm coordinate their wins and losses such that the performance is successful, and the total score of the performance is maximized.

Input: The first line contains an integer $t$ ($1\leq t \leq 10^3$) — the number of test cases.

The only line of each test case contains four integers $n$, $m$, $l$, $f$ ($2\leq n\leq m \leq 2\cdot 10^7$, $1\leq l,f \leq 10^9$, $\bf{n=m}$): $n$, $m$ gives the upper bound on the number of Lelle and Flamm's wins, $l$ and $f$ determine the final score of the performance.

Unusual additional constraint: it is guaranteed that, for each test, there are no pairs of test cases with the same pair of $n$, $m$.

Output: For each test case, output a single integer — the maximum total score of a successful performance.

Examples:
input:
8
3 3 2 5
4 4 1 4
6 6 2 2
7 7 2 3
9 9 9 1
2 2 1 4
5 5 1 4
8 8 6 7
output:
19
17
18
33
86
9
24
86

input:
1
20000000 20000000 1341 331
output:
33439999007

input:
2
1984 1984 19 84
9982 9982 44 35
output:
204143
788403

Note: In the first test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Flamm wins, $\gcd(1,2)=1$.    * Flamm wins, $\gcd(1,3)=1$.    * Lelle wins, $\gcd(2,3)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $2\cdot2+3\cdot5=19$.

In the third test case, a possible performance is as follows:

  * Flamm wins, $\gcd(0,1)=1$.    * Lelle wins, $\gcd(1,1)=1$.    * Lelle wins, $\gcd(2,1)=1$.    * Lelle wins, $\gcd(3,1)=1$.    * Lelle wins, $\gcd(4,1)=1$.    * Lelle wins, $\gcd(5,1)=1$.    * Flamm wins, $\gcd(5,2)=1$.    * Flamm wins, $\gcd(5,3)=1$.    * Flamm wins, $\gcd(5,4)=1$.    * Lelle and Flamm agree to stop the match.

The final score is $5\cdot2+4\cdot2=18$. Note that Lelle and Flamm can stop the match even if neither of them has $n$ wins.

Buggy Code:
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main{
	private static FastReader sc = new FastReader();
	private static PrintStream out =System.out;
	private static final long mod =1000000007;
	private static int n ,m ;
	private static long l ,f ,res;
	private static Set<Long> st;
	public static void main (String[] args) throws java.lang.Exception{
		PrimeNumber pn =new PrimeNumber(20000000);
		for(int t =sc.nextInt() ;t >0 ;t--) {
			n =sc.nextInt();
			m =sc.nextInt();
			l =sc.nextLong();
			f =sc.nextLong();
			if(l <f) { l^=f; f ^=l; l ^=f;}
			int mxp =pn.binarys(n);
			res =n *l +f;
			st =new HashSet();
			dfs(pn.arr.get(mxp) ,pn.arr.get(mxp -1));
			out.println(res);
		}
	}
	private static int gcd(int x ,int y) {
		return (y ==0) ?x :gcd(y ,x %y);
	}
	private static void dfs(int a ,int b) {
		st.add(hashvalue(a ,b));
		res =Math.max(res ,l *a +f *b);
		if(gcd(a ,b +1) <=1 && b <m && !st.contains(hashvalue(a ,b +1))) dfs(a ,b +1);
		if(gcd(a +1,b) <=1 && a <n && !st.contains(hashvalue(a +1 ,b))) dfs(a +1,b);
	}
	private static long hashvalue(int a ,int b) {
		return ((long)a<<30 )+b;
	}
}
class PrimeNumber{
	ArrayList<Integer> arr;
	PrimeNumber(int n){
		boolean flag[] =new boolean[n +1];
		arr =new ArrayList();
		arr.add(0);
		arr.add(1);
		for(int e =2 ;e <=n ;e++) {
			if(flag[e] ==false) {
				arr.add(e);
				for(int f =e ;f <=n ;f+=e) flag[f] =true;
			}
		}
	}
	public int binarys(int val) {
		int fr =1 ,ls =arr.size() -1 ,res =0;
		while(fr <=ls) {
			int mid =(fr +ls)>>1;
			if(arr.get(mid) <=val) {
				res =mid;
				fr =mid +1;
			}else {
				ls =mid -1;
			}
		}
		return res;
	}
}
class FastReader {
	BufferedReader br;
	StringTokenizer st;

	public FastReader() {
		br = new BufferedReader(new InputStreamReader(System.in));
	}

	String next() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}

	String nextLine() {
		String str = "";
		try {
			if (st.hasMoreTokens()) {
				str = st.nextToken("\n");
			} else {
				str = br.readLine();
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return str;
	}
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided buggy code, we need to focus on edge cases that can cause the algorithm to fail. The key aspects to consider are:

1. **Boundary Conditions**: Values of \( n \) and \( m \) that are at the limits of the allowed range.
2. **GCD Constraints**: Situations where the GCD constraint (\(\gcd(W_L, W_F) \le 1\)) is critical.
3. **Score Maximization**: Scenarios where the score maximization logic might fail due to the GCD constraint.

Given that \( n = m \) and both are in the range \([2, 2 \times 10^7]\), and the values of \( l \) and \( f \) are in the range \([1, 10^9]\), we can craft a test case that tests these boundaries and constraints effectively.

### Step-by-Step Reasoning:

1. **Choose \( n \) and \( m \) to be the same and relatively small to ensure the test case is small-scale but still challenging.**
2. **Set \( l \) and \( f \) such that the score maximization logic is tested.**
3. **Ensure the GCD constraint is critical by setting \( l \) and \( f \) such that the GCD of \( W_L \) and \( W_F \) is often 1.**

### Test Case:

Let's choose:
- \( n = m = 5 \)
- \( l = 1 \)
- \( f = 4 \)

This test case is small-scale but will test the GCD constraint and score maximization logic. The values of \( l \) and \( f \) are chosen such that the score maximization logic will need to consider the GCD constraint carefully.

### Test Input:

```plaintext
1
5 5 1 4
```

### Explanation:

- **Input**: One test case where \( n = 5 \), \( m = 5 \), \( l = 1 \), and \( f = 4 \).
- **Expected Output**: The maximum total score of a successful performance.

This test case will challenge the algorithm to ensure that the GCD constraint is respected while maximizing the score. The small scale ensures that the test case is manageable but still effective in exposing potential bugs.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Two Screens
time_limit_ms: 2000
memory_limit_mb: 512
Description: There are two screens which can display sequences of uppercase Latin letters. Initially, both screens display nothing.

In one second, you can do one of the following two actions:

  * choose a screen and an uppercase Latin letter, and append that letter to the end of the sequence displayed on that screen;    * choose a screen and copy the sequence from it to the other screen, overwriting the sequence that was displayed on the other screen.

You have to calculate the minimum number of seconds you have to spend so that the first screen displays the sequence $s$, and the second screen displays the sequence $t$.

Input: The first line contains one integer $q$ ($1 \le q \le 500$) — the number of test cases.

Each test case consists of two lines. The first line contains the string $s$, and the second line contains the string $t$ ($1 \le |s|, |t| \le 100$). Both strings consist of uppercase Latin letters.

Output: For each test case, print one integer — the minimum possible number of seconds you have to spend so that the first screen displays the sequence $s$, and the second screen displays the sequence $t$.

Examples:
input:
3
GARAGE
GARAGEFORSALE
ABCDE
AABCD
TRAINING
DRAINING
output:
14
10
16

Note: In the first test case, the following sequence of actions is possible:

  * spend $6$ seconds to write the sequence GARAGE on the first screen;    * copy the sequence from the first screen to the second screen;    * spend $7$ seconds to complete the sequence on the second screen by writing FORSALE.

In the second test case, the following sequence of actions is possible:

  * spend $1$ second to write the sequence A on the second screen;    * copy the sequence from the second screen to the first screen;    * spend $4$ seconds to complete the sequence on the first screen by writing BCDE;    * spend $4$ seconds to complete the sequence on the second screen by writing ABCD.

In the third test case, the fastest way to display the sequences is to type both of them character by character without copying, and this requires $16$ seconds.

Buggy Code:
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define int long long
#define pi pair<int, int>
#define fi first
#define se second

int d4x[4] = {1, 0, -1, 0}; int d4y[4] = {0, 1, 0, -1};
int d8x[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int d8y[8] = {1, 1, 0, -1, -1, -1, 0, 1};

template<class X, class Y>
    bool minimize(X &x, const Y &y) {
        if (x > y)
        {
            x = y;
            return true;
        }
        return false;
    }

template<class X, class Y>
    bool maximize(X &x, const Y &y) {
        if (x < y)
        {
            x = y;
            return true;
        }
        return false;
    }

void answer() {
    string s, t;
    cin >> s >> t;
    int n = sz(s), m = sz(t);
    s = ' ' + s, t = ' ' + t;
    int res = 0;
    bool ok = false;
    for (int i = 1; i <= min(n, m); ++i) {
        if (s[i] == t[i]) ++res;
        else {
            if (i > 1) ok = true;
            res += n - i + 1;
            res += m - i + 1;
            break;
        }
    }
    if (ok) ++res;
    if (m > n) res += m - n + 1;
    cout << res << endl;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tt = 1;
    cin >> tt;
    for (int i = 1; i <= tt; ++i) {
        answer();
    }
    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
AAAA
AAAA
ABCDEF
ABCDEF
ABCD
EFGH
```