#include "bits/stdc++.h"
#define up(i,a,b) for (int i = (int)a; i <= (int)b; i++)
using namespace std;
string addBig(string a, string b){
string res = "";
while (a.size() < b.size()) a = "0" + a;
while (b.size() < a.size()) b = "0" + b;
int cr = 0;
for (int i = a.size()-1; i >= 0; i--){
int t = a[i] + b[i] - 48*2 + cr;
cr = t/10;
t = t % 10;
res = (char)(t+48) + res;
}
if (cr) res = '1' + res;
return res;
}
string mulBig(string a, string b){
string res = "";
int n = a.size();
int m = b.size();
int len = n + m - 1;
int cr = 0;
for (int i = len; i >= 0; i--){
int t = 0;
for (int j = n-1; j >= 0; j--){
if (i-j <= m && i-j >= 1){
int a1 = a[j] - 48;
int b1 = b[i-j-1] - 48;
t += a1*b1;
}
}
t += cr;
cr = t/10;
res = (char)(t % 10 + 48) + res;
}
while (res.size() > 1 && res[0] == '0') res.erase(0,1);
return res;
}
long long n,M;
struct Matrix{
string c[2][2];
Matrix(){
c[0][0] = "1"; c[0][1] = "1";
c[1][0] = "1"; c[1][1] = "0";
}
~Matrix(){};
}; Matrix A;
Matrix nhan(Matrix a, Matrix b){
Matrix res;
for (int i = 0; i <= 1; i++){
for (int j = 0; j <= 1; j++){
res.c[i][j] = "0";
for (int k = 0; k <= 1; k++){
res.c[i][j] = addBig(res.c[i][j], mulBig(a.c[i][k], b.c[k][j]));
}
}
}
return res;
}
Matrix Fpow(Matrix& A, int n){
Matrix res;
up(i,0,1) up(j,0,1) res.c[i][j] = "0";
up(i,0,1) res.c[i][i] = "1";
for (; n; n >>= 1, A = nhan(A, A)){
if (n & 1) res = nhan(res, A);
}
return res;
}
string a,b;
#define Task "A"
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
if (fopen(Task".inp", "r")){
freopen(Task".inp", "r", stdin);
freopen(Task".out", "w", stdout);
}
int tt;
cin >> tt;
while (tt--){
int n;
cin >> n;
Matrix A;
A = Fpow(A, n);
cout << A.c[0][0] << "\n";
}
}
I2luY2x1ZGUgImJpdHMvc3RkYysrLmgiCiNkZWZpbmUgdXAoaSxhLGIpIGZvciAoaW50IGkgPSAoaW50KWE7IGkgPD0gKGludCliOyBpKyspCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdHJpbmcgYWRkQmlnKHN0cmluZyBhLCBzdHJpbmcgYil7CiAgICBzdHJpbmcgcmVzID0gIiI7CiAgICB3aGlsZSAoYS5zaXplKCkgPCBiLnNpemUoKSkgYSA9ICIwIiArIGE7CiAgICB3aGlsZSAoYi5zaXplKCkgPCBhLnNpemUoKSkgYiA9ICIwIiArIGI7CiAgICBpbnQgY3IgPSAwOwogICAgZm9yIChpbnQgaSA9IGEuc2l6ZSgpLTE7IGkgPj0gMDsgaS0tKXsKICAgICAgICBpbnQgdCA9IGFbaV0gKyBiW2ldIC0gNDgqMiArIGNyOwogICAgICAgIGNyID0gdC8xMDsKICAgICAgICB0ID0gdCAlIDEwOwogICAgICAgIHJlcyA9IChjaGFyKSh0KzQ4KSArIHJlczsKICAgIH0KICAgIGlmIChjcikgcmVzID0gJzEnICsgcmVzOwogICAgcmV0dXJuIHJlczsKfQoKc3RyaW5nIG11bEJpZyhzdHJpbmcgYSwgc3RyaW5nIGIpewogICAgc3RyaW5nIHJlcyA9ICIiOwogICAgaW50IG4gPSBhLnNpemUoKTsKICAgIGludCBtID0gYi5zaXplKCk7CiAgICBpbnQgbGVuID0gbiArIG0gLSAxOwogICAgaW50IGNyID0gMDsKICAgIGZvciAoaW50IGkgPSBsZW47IGkgPj0gMDsgaS0tKXsKICAgICAgICBpbnQgdCA9IDA7CiAgICAgICAgZm9yIChpbnQgaiA9IG4tMTsgaiA+PSAwOyBqLS0pewogICAgICAgICAgICBpZiAoaS1qIDw9IG0gJiYgaS1qID49IDEpewogICAgICAgICAgICAgICAgaW50IGExID0gYVtqXSAtIDQ4OwogICAgICAgICAgICAgICAgaW50IGIxID0gYltpLWotMV0gLSA0ODsKICAgICAgICAgICAgICAgIHQgKz0gYTEqYjE7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgdCArPSBjcjsKICAgICAgICBjciA9IHQvMTA7CiAgICAgICAgcmVzID0gKGNoYXIpKHQgJSAxMCArIDQ4KSArIHJlczsKICAgIH0KICAgIHdoaWxlIChyZXMuc2l6ZSgpID4gMSAmJiByZXNbMF0gPT0gJzAnKSByZXMuZXJhc2UoMCwxKTsKICAgIHJldHVybiByZXM7Cn0KCmxvbmcgbG9uZyBuLE07CnN0cnVjdCBNYXRyaXh7CiAgICBzdHJpbmcgY1syXVsyXTsKICAgIE1hdHJpeCgpewogICAgICAgIGNbMF1bMF0gPSAiMSI7ICAgICAgICBjWzBdWzFdID0gIjEiOwoKICAgICAgICBjWzFdWzBdID0gIjEiOyAgICAgICAgY1sxXVsxXSA9ICIwIjsKICAgIH0KICAgIH5NYXRyaXgoKXt9Owp9OyBNYXRyaXggQTsKCk1hdHJpeCBuaGFuKE1hdHJpeCBhLCBNYXRyaXggYil7CiAgICBNYXRyaXggcmVzOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPD0gMTsgaSsrKXsKICAgICAgICBmb3IgKGludCBqID0gMDsgaiA8PSAxOyBqKyspewogICAgICAgICAgICByZXMuY1tpXVtqXSA9ICIwIjsKICAgICAgICAgICAgZm9yIChpbnQgayA9IDA7IGsgPD0gMTsgaysrKXsKICAgICAgICAgICAgICAgIHJlcy5jW2ldW2pdID0gYWRkQmlnKHJlcy5jW2ldW2pdLCBtdWxCaWcoYS5jW2ldW2tdLCBiLmNba11bal0pKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHJldHVybiByZXM7Cn0KCk1hdHJpeCBGcG93KE1hdHJpeCYgQSwgaW50IG4pewogICAgTWF0cml4IHJlczsKICAgIHVwKGksMCwxKSB1cChqLDAsMSkgcmVzLmNbaV1bal0gPSAiMCI7CiAgICB1cChpLDAsMSkgcmVzLmNbaV1baV0gPSAiMSI7CiAgICBmb3IgKDsgbjsgbiA+Pj0gMSwgQSA9IG5oYW4oQSwgQSkpewogICAgICAgIGlmIChuICYgMSkgcmVzID0gbmhhbihyZXMsIEEpOwogICAgfQogICAgcmV0dXJuIHJlczsKfQoKc3RyaW5nIGEsYjsKI2RlZmluZSBUYXNrICJBIgpzaWduZWQgbWFpbigpewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7CiAgICBjaW4udGllKDApOwogICAgaWYgKGZvcGVuKFRhc2siLmlucCIsICJyIikpewogICAgICAgIGZyZW9wZW4oVGFzayIuaW5wIiwgInIiLCBzdGRpbik7CiAgICAgICAgZnJlb3BlbihUYXNrIi5vdXQiLCAidyIsIHN0ZG91dCk7CiAgICB9CgogICAgaW50IHR0OwogICAgY2luID4+IHR0OwogICAgd2hpbGUgKHR0LS0pewogICAgICAgIGludCBuOwogICAgICAgIGNpbiA+PiBuOwogICAgICAgIE1hdHJpeCBBOwogICAgICAgIEEgPSBGcG93KEEsIG4pOwogICAgICAgIGNvdXQgPDwgQS5jWzBdWzBdIDw8ICJcbiI7CiAgICB9Cn0=