#include #include #include #define mod 1000000007 __int64 a[1000005]= {0,1,2}; int main() { int i,j,T,n,m=1; for(i=3; i<=1000000; i++) a[i]=(a[i-1]+((i-1)*a[i-2])%mod)%mod; scanf("%d",&T); while(T--) { scanf("%d",&n); printf("Case #%d:\n",m++); printf("%I64d\n",a[n]); } return 0; }