#include #include #include using namespace std; typedef long long ll; typedef pair pii; #define rep(i, n) for(int i = 0; i < n; ++i) #define ri(a) scanf("%d", &a) #define rii(a, b) scanf("%d%d", &a, &b) #define riii(a, b, c) scanf("%d%d%d", &a, &b, &c) #define Ttimes int T; ri(T); for(int ks = 1; ks <= T; ++ks) const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; int d[1000000 + 10] = {0, 1, 2}; int main() { for(int i = 3; i <= 1000000; ++i) d[i] = (1LL * (i - 1) * d[i - 2] + d[i - 1]) % 1000000007; Ttimes { int n; ri(n); printf("Case #%d:\n", ks); printf("%d\n", d[n]); } return 0; }