#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int MAX = 522133279; const double pi = 3.1415926535897; const int mod = 1000000007; long long int dp[1000000 + 100]; int main( ) { int T,N; cin >> T; dp[0] = dp[1] = 1; for ( int i = 2; i < 1000000 + 50; i++ ) { dp[i] = ( dp[i - 1] + ( dp[i - 2] * ( i - 1 ) ) % mod ) % mod; } for ( int i = 1; i <= T; i++ ) { cin >> N; cout << "Case #" << i << ":\n" << dp[N] << endl; } return 0; }