#include #include #include #include #include #include #include #include #include using namespace std; #define N 1000005 #define mod 1000000007 #define ll long long #define inf 0x3fffffff ll dp[N]; void ini() { memset(dp,0,sizeof(dp)); dp[0] = 1; dp[1] = 1; int i; for(i = 2;i <= N -5;i++){ dp[i] = (dp[i - 1] + (i - 1) * dp[i - 2]) % mod; } } int main() { ini(); //freopen("in.txt","r",stdin); int T,n; scanf("%d",&T); for(int ccnt = 1;ccnt <= T;ccnt++){ scanf("%d",&n); printf("Case #%d:\n",ccnt); printf("%I64d\n",dp[n]); } //freopen("out.txt","w",stdout); return 0; }