You should generate the input data in your programme.
We have a private variable $x$ in the generation,which equals to $seed$ initially.When you call for a random number ranged from $[l,r]$,the generation will trans $x$ into $\left(50268147x+6082187\right)\ mod\ 100000007$.And then,it will return $x\ mod\ \left(r-l+1 \right)+l$.
The first line contains a single integer $T$ refers to the number of testcases.
For each testcase,there is a single line contains 4 integers $n, m, k, seed$.
Then,you need to generate the $k$ flags' coordinates.
For $i=1\cdots k$,firstly generate a random number in the range of $\left[1,n \right]$.Then generate a random number in the range of $\left[1,m \right]$.
You can also copy the following code and run "Init" to generate the x[],y[] (only for C++ players).
const int _K=50268147,_B=6082187,_P=100000007;
int _X;
inline int get_rand(int _l,int _r){
_X=((long long)_K*_X+_B)%_P;
return _X%(_r-_l+1)+_l;
}
int n,m,k,seed;
int x[1000001],y[1000001];
void Init(){
scanf("%d%d%d%d",&n,&m,&k,&seed);
_X=seed;
for (int i=1;i<=k;++i)
x[i]=get_rand(1,n),
y[i]=get_rand(1,m);
}
$\left(1\leq T\leq 7 \right)$,$\left(1\leq n,m\leq 1000000 \right)$,$\left(0\leq k\leq 1000000 \right)$,$\left(0\leq seed<100000007 \right)$