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