#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; ll f[2010][27][4], ans[2010]; const ll MOD = 1000000007; int main() { int T; scanf("%d", &T); f[0][0][1] = 1; for (int i = 1; i <= 2000; i++) for (int j = 1; j <= 26; j++) { for (int k = 0; k <= 26; k++) if (j != k) { f[i][j][1] = (f[i][j][1] + f[i - 1][k][1] + f[i - 1][k][2] + f[i - 1][k][3]) % MOD; } for (int k = 2; k <= 3; k++) f[i][j][k] = (f[i][j][k] + f[i - 1][j][k - 1]) % MOD; } for (int i = 1; i <= 2000; i++) for (int j = 1; j <= 26; j++) for (int k = 1; k <= 3;k++) ans[i] = (ans[i] + f[i][j][k]) % MOD; while (T--) { int n; scanf("%d", &n); printf("%I64d\n", ans[n]); } }