#include using namespace std; long long a[1000001]; int main() { int t; int i; a[1] = 1; a[2] = 2; for(i=3; i<=1000000; i++) { a[i] = (a[i - 1] + a[i - 2] * (i - 1) % 1000000007) % 1000000007; } cin >> t; int x; for(i=1; i<=t; i++) { cin >> x; cout << "Case #" << i << ":\n"; cout << a[x] << endl; } return 0; }