#include<iostream>
#include <vector>
using namespace std;

int main() {
	int t;
	cin >> t;
	while(t--){
		int n;
		cin >> n;
		vector <pair <int, int> > dp (n+1);	//ends with 0,1
		dp[0] = make_pair(0,0);
		dp[1] = make_pair(1,1);
		for(int i=2; i<=n; i++){
			int endWith1 = dp[i-1].first;
			int endWith0 = dp[i-1].first + dp[i-1].second;
			dp[i] = make_pair(endWith0, endWith1);
		}
		cout << dp[n].first + dp[n].second << endl;
	}
	return 0;
}