#include <iostream>
#include <vector>
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int count = 0;
std::cin >> count;
const int k_max_level = 2 * 1e6 + 1;
const int64_t k_value_mod = 1e9 + 7;
std::vector<int64_t> crazy_tree_count(k_max_level, 0);
std::vector<bool> head_use(k_max_level, false);
crazy_tree_count[3] = 4;
head_use[3] = true;
for (int level = 4; level < k_max_level; ++level) {
crazy_tree_count[level] =
2 * crazy_tree_count[level - 2] + crazy_tree_count[level - 1];
if (!head_use[level - 1] && !head_use[level - 2]) {
head_use[level] = true;
crazy_tree_count[level] += 4;
}
crazy_tree_count[level] %= k_value_mod;
}
for (int index = 0; index < count; ++index) {
int level;
std::cin >> level;
std::cout << crazy_tree_count[level] << std::endl;
}
return 0;
}
1216C - White Sheet | 1648A - Weird Sum |
427A - Police Recruits | 535A - Tavas and Nafas |
581A - Vasya the Hipster | 1537B - Bad Boy |
1406B - Maximum Product | 507B - Amr and Pins |
379A - New Year Candles | 1154A - Restoring Three Numbers |
750A - New Year and Hurry | 705A - Hulk |
492B - Vanya and Lanterns | 1374C - Move Brackets |
1476A - K-divisible Sum | 1333A - Little Artem |
432D - Prefixes and Suffixes | 486A - Calculating Function |
1373B - 01 Game | 1187A - Stickers and Toys |
313B - Ilya and Queries | 579A - Raising Bacteria |
723A - The New Year Meeting Friends | 302A - Eugeny and Array |
1638B - Odd Swap Sort | 1370C - Number Game |
1206B - Make Product Equal One | 131A - cAPS lOCK |
1635A - Min Or Sum | 474A - Keyboard |