#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll gcd(ll a,ll b){
	if(a<b)swap(a,b);
	if(b==0) return a;
	else return gcd(b,a%b);
}
ll extgcd(ll a,ll b,ll &x,ll &y){
	ll g = a; x = 1; y = 0;
	if(b != 0) g = extgcd(b,a%b,y,x),y-=(a/b)*x;
	return g;
}
ll AxB(ll A,ll B,ll C){
	//minimum non-negaitive x such that Ax godo b (mod C)
	if(B%gcd(A,C) != 0) return -1;
	ll x,y;
	extgcd(A,C,x,y);
	x = x*B/gcd(A,C)%(C/gcd(A,C));
	ll f = C/gcd(A,C);
	if(x > 0){
		x %= abs(f);
	}
	else{
		x = (x%abs(f)+abs(f))%abs(f);
	}
	return x;
}
int n;
int main(){
    cin>>n;
    rep(q,n){
    	ll a,b;cin>>a>>b;
    	ll g=gcd(a,b);
    	if(g<=50000){
    		ll v = AxB(a,g,b);
    		ll vv = a*v-g;
    		vv /= b;
    		//a*v-b*vv = g
    		ll v2 = AxB(a,-g,b);
    		ll vv2 = a*v2+g;
    		vv2 /= b;
    		//a*v2-b*vv2 = -g
    		assert((v>=0 && vv>=0) || (v2>=0 && vv2>=0));
    		if(v2>=0 && vv2>=0){ v = v2; vv = vv2; }
    		cout<<3<<endl;
    		cout<<0<<" "<<0<<endl;
    		cout<<a<<" "<<b<<endl;
    		cout<<vv<<" "<<v<<endl;
    	}
    	else{
    		cout<<4<<endl;
    		cout<<0<<" "<<1<<endl;
    		cout<<a<<" "<<b<<endl;
    		cout<<1<<" "<<0<<endl;
    		cout<<a-a/g<<" "<<b-b/g<<endl;
    	}
    }
}
### Prompt

Please provide a Cpp coded solution to the problem described below:

Example

Input

2
5 6
1000000000 2


Output

4
5 6
0 6
0 0
5 0
3
1000000000 0
0 2
999999999 0

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll gcd(ll a,ll b){
	if(a<b)swap(a,b);
	if(b==0) return a;
	else return gcd(b,a%b);
}
ll extgcd(ll a,ll b,ll &x,ll &y){
	ll g = a; x = 1; y = 0;
	if(b != 0) g = extgcd(b,a%b,y,x),y-=(a/b)*x;
	return g;
}
ll AxB(ll A,ll B,ll C){
	//minimum non-negaitive x such that Ax godo b (mod C)
	if(B%gcd(A,C) != 0) return -1;
	ll x,y;
	extgcd(A,C,x,y);
	x = x*B/gcd(A,C)%(C/gcd(A,C));
	ll f = C/gcd(A,C);
	if(x > 0){
		x %= abs(f);
	}
	else{
		x = (x%abs(f)+abs(f))%abs(f);
	}
	return x;
}
int n;
int main(){
    cin>>n;
    rep(q,n){
    	ll a,b;cin>>a>>b;
    	ll g=gcd(a,b);
    	if(g<=50000){
    		ll v = AxB(a,g,b);
    		ll vv = a*v-g;
    		vv /= b;
    		//a*v-b*vv = g
    		ll v2 = AxB(a,-g,b);
    		ll vv2 = a*v2+g;
    		vv2 /= b;
    		//a*v2-b*vv2 = -g
    		assert((v>=0 && vv>=0) || (v2>=0 && vv2>=0));
    		if(v2>=0 && vv2>=0){ v = v2; vv = vv2; }
    		cout<<3<<endl;
    		cout<<0<<" "<<0<<endl;
    		cout<<a<<" "<<b<<endl;
    		cout<<vv<<" "<<v<<endl;
    	}
    	else{
    		cout<<4<<endl;
    		cout<<0<<" "<<1<<endl;
    		cout<<a<<" "<<b<<endl;
    		cout<<1<<" "<<0<<endl;
    		cout<<a-a/g<<" "<<b-b/g<<endl;
    	}
    }
}
```