#include <iostream> #include <cmath> using namespace std; int main() { int n; cin >> n; int *data = new int[n]; long long value = (pow(10, 9) + 7); long long *count = new long long[n](); int i = 0; while (i < n) { int temp; cin >> temp; data[i]=temp; i++; } for (long long j = 0; j < n; j++) { long long N = data[j]; if (N == 1) { count[j] = 1; continue; } for (long long k = 1; k <= N; k++) { long long num1 = N + 1 - k; for (long long m = 1; m <= N; m++) { long long num2 = N + 1 - m; for (long long h = 1; h <= N; h++) { long long num3 = N + 1 - h; if ((num1 == num2 &&num1 == num3) || (num1 != num2&&num1 != num3&&num2 != num3)) { long long result = (num1*num2*num3) % value; //(num1*num2*num3)-((num1 *num2*num3) / value)*value; count[j] += result; if (count[j] > value) { count[j] %= value; } } else if (k==m&&k<h) { break; } else { continue; } } } } } for (long long i = 0; i < n; i++) { cout << "Case " << i + 1 << ": " << count[i] << endl; } delete[] data; delete[] count; return 0; } </cmath></iostream>