#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef pair pii; typedef long long ull; typedef long long ll; typedef vector vi; #define xx first #define yy second #define rep(i, a, n) for (int i = a; i < n; i++) #define sa(n) scanf("%d", &(n)) #define vep(c) for(decltype((c).begin()) it = (c).begin(); it != (c).end(); it++) const int mod = int(1e9) + 7, INF = 0x3fffffff, maxn = 1e5 + 12; ll dp[2008][28], dps[2008][28]; int main(void) { int T; cin >> T; while (T--) { int n; sa(n); for (int i = 0; i <= n; i++) { for (int j = 0; j <= 27; j++) { dp[i][j] = 0; dps[i][j] = 0; } } rep (i, 0, 26) dp[0][i] = dp[1][i] = 1, dp[0][27] = 2, dp[1][27] += 1; rep (i, 0, 26) dp[2][i] = 26, dp[2][27] += 26; rep (i, 0, 26) dp[3][i] = 26 * 26, dp[3][27] += 26 * 26; rep (i, 0, 26) dps[1][i] = 25; rep (i, 0, 26) dps[2][i] = 26 * 25; rep (i, 0, 26) dps[3][i] = 26 * 26 * 25; for (int i = 4; i <= n; i++) { for (int j = 0; j < 26; j++) { dp[i][j] = (dps[i - 1][j] + dps[i - 2][j] + dps[i - 3][j]) % mod; for (int k = 0; k < 26; k++) { if (j != k) dps[i][k] = (dps[i][k] + dp[i][j]) % mod; } } } ll ans = 0; rep (i, 0, 26) ans = (dp[n][i] + ans) % mod; cout << ans << endl; } return 0; }