#include <iostream> #include<cstdio> #include<cstring> #include<queue> using namespace std; #define ll long long const int N =100009; const ll mod = 1000000007; ll c[N][10]; void init() { c[0][0] =1ll; for(int i =1;i<N;i++){ for(int j =0;j<=5;j++){ if(j==0||j==i) c[i][j]=1ll; else c[i][j] = (c[i-1][j-1]%mod+c[i-1][j]%mod)%mod; } } } int t,n,m; int main() { init(); scanf("%d",&t); for(int i =1;i<=t;i++) { scanf("%d%d",&n,&m); if(n<3||m<3) printf("Case %d: 0 ",i); else{ ll x = (c[n][3]+c[n][4])%mod; ll y = (c[m][3]+c[m][4])%mod; x=(x*y)%mod; printf("Case %d: %lld ",i,x); } } return 0; }