/************************************************************** User: error408 Language: C/C++ School: SSDUT Saying: Do one thing at a time,and do well. ****************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define clr(s,x) memset((s),(x),sizeof(s)) #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define lowbit(x) (x&(-x)) #define PB push_back #define For(i,a,b) for(int i=a;i vint; typedef vector vstring; /************************************END DEFINE*********************************************/ const int maxn = 1e6 + 1000; const LL mod = 1000000007LL; LL dp[maxn]; int main() { int t,cas = 1; cin>>t; clr(dp,0); dp[1] = 1; dp[2] = 2; for(int i=3;i<=maxn-1;i++){ dp[i] = (dp[i-1]+(i-1)*dp[i-2])%mod; } while(t--){ int n; scanf("%d",&n); printf("Case #%d:\n",cas++); printf("%I64d\n",dp[n]); } return 0; }