#include"cstdio" #include"queue" #include"cmath" #include"stack" #include"iostream" #include"algorithm" #include"cstring" #include"queue" #include"map" #include"set" #include"vector" #define LL long long #define mems(a,b) memset(a,b,sizeof(a)) #define ls pos<<1 #define rs pos<<1|1 using namespace std; const int N = 1e6+5; const int MOD = 1e9+7; const int INF = 0x3f3f3f3f; int n,T,p=1; LL dp[N]; int main(){ dp[1]=1; dp[2]=2; for(int i=3;i<=1000000;i++) dp[i]=(dp[i-1]+dp[i-2]*(i-1))%MOD; scanf("%d",&T); while(T--){ scanf("%d",&n); printf("Case #%d:\n%I64d\n",p++,dp[n]); } return 0; }