#include<stdio.h> int main(){ int T,i,n; long long a[66]={1,2,4,8}; scanf("%d",&T); while(T--){ scanf("%d",&n); for(i=4;i<66;i++) a[i]=a[i-1]+a[i-2]+a[i-3]+a[i-4]; printf("%lld\n",a[n-1]);} return 0; } //1019