//starusc
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
	int x=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<1)+(x<<3)+(c^48);c=getchar();}
	return f==1?x:-x;
}
#define min_(a,b) (a>b?b:a)
#define pai pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
const int N=1e5+4,inf=1e18,mod=1e9+7;
int fei[100],cn;
vector<pai>a[100];
inline void init(){
	fei[1]=fei[2]=1;
	cn=2;
	while(fei[cn]<inf){
		++cn;
		fei[cn]=fei[cn-1]+fei[cn-2];
	}
	a[1].pb(mp(1,2));
	for(int i=2;i<=cn;i++){
		for(int j=0;j<(signed)a[i-1].size();j++){
			a[i].pb(mp(a[i-1][j].se,a[i-1][j].fi+a[i-1][j].se));
		}
		a[i].pb(mp(a[i][0].se,a[i][0].se*2-a[i][0].fi));
	}
}
signed main(){
	init();
	int u,v,mu,mv,mx,ans,T=read();
	while(T--){
		u=read();v=read();
		mu=upper_bound(fei+2,fei+cn+1,u)-fei-1;//<= 
		mv=upper_bound(fei+2,fei+cn+1,v)-fei-1;
		if(mu==mv)mv--;
		mx=min_(mu,mv);
		if(mx>1)mx--;
		cout<<mx<<" ";
		if(mx==1)cout<<(u%mod)*(v%mod)%mod;
		else{
			ans=0;
			for(int i=0,x,y;i<(signed)a[mx].size();i++){
				x=a[mx][i].fi;y=a[mx][i].se;
//				printf("%d %d sdlk\n",x,y);
				ans=(ans+((u>=y&&v>=x)?((u-y)/x+1):0)+((v>=y&&u>=x)?((v-y)/x+1):0))%mod;
			}
			cout<<ans;
		}
		puts("");
	}
	return (0-0);
}
### Prompt

Please formulate a Cpp solution to the following problem:

Kenus, the organizer of International Euclidean Olympiad, is seeking a pair of two integers that requires many steps to find its greatest common divisor using the Euclidean algorithm.

You are given Q queries. The i-th query is represented as a pair of two integers X_i and Y_i, and asks you the following: among all pairs of two integers (x,y) such that 1 ≤ x ≤ X_i and 1 ≤ y ≤ Y_i, find the maximum Euclidean step count (defined below), and how many pairs have the maximum step count, modulo 10^9+7.

Process all the queries. Here, the Euclidean step count of a pair of two non-negative integers (a,b) is defined as follows:

* (a,b) and (b,a) have the same Euclidean step count.
* (0,a) has a Euclidean step count of 0.
* If a > 0 and a ≤ b, let p and q be a unique pair of integers such that b=pa+q and 0 ≤ q < a. Then, the Euclidean step count of (a,b) is the Euclidean step count of (q,a) plus 1.

Constraints

* 1 ≤ Q ≤ 3 × 10^5
* 1 ≤ X_i,Y_i ≤ 10^{18}(1 ≤ i ≤ Q)

Input

The input is given from Standard Input in the following format:


Q
X_1 Y_1
:
X_Q Y_Q


Output

For each query, print the maximum Euclidean step count, and the number of the pairs that have the maximum step count, modulo 10^9+7, with a space in between.

Examples

Input

3
4 4
6 10
12 11


Output

2 4
4 1
4 7


Input

10
1 1
2 2
5 1000000000000000000
7 3
1 334334334334334334
23847657 23458792534
111111111 111111111
7 7
4 19
9 10


Output

1 1
1 4
4 600000013
3 1
1 993994017
35 37447
38 2
3 6
3 9
4 2

### Response

```cpp
//starusc
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
	int x=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<1)+(x<<3)+(c^48);c=getchar();}
	return f==1?x:-x;
}
#define min_(a,b) (a>b?b:a)
#define pai pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
const int N=1e5+4,inf=1e18,mod=1e9+7;
int fei[100],cn;
vector<pai>a[100];
inline void init(){
	fei[1]=fei[2]=1;
	cn=2;
	while(fei[cn]<inf){
		++cn;
		fei[cn]=fei[cn-1]+fei[cn-2];
	}
	a[1].pb(mp(1,2));
	for(int i=2;i<=cn;i++){
		for(int j=0;j<(signed)a[i-1].size();j++){
			a[i].pb(mp(a[i-1][j].se,a[i-1][j].fi+a[i-1][j].se));
		}
		a[i].pb(mp(a[i][0].se,a[i][0].se*2-a[i][0].fi));
	}
}
signed main(){
	init();
	int u,v,mu,mv,mx,ans,T=read();
	while(T--){
		u=read();v=read();
		mu=upper_bound(fei+2,fei+cn+1,u)-fei-1;//<= 
		mv=upper_bound(fei+2,fei+cn+1,v)-fei-1;
		if(mu==mv)mv--;
		mx=min_(mu,mv);
		if(mx>1)mx--;
		cout<<mx<<" ";
		if(mx==1)cout<<(u%mod)*(v%mod)%mod;
		else{
			ans=0;
			for(int i=0,x,y;i<(signed)a[mx].size();i++){
				x=a[mx][i].fi;y=a[mx][i].se;
//				printf("%d %d sdlk\n",x,y);
				ans=(ans+((u>=y&&v>=x)?((u-y)/x+1):0)+((v>=y&&u>=x)?((v-y)/x+1):0))%mod;
			}
			cout<<ans;
		}
		puts("");
	}
	return (0-0);
}
```