#include <iostream> using namespace std; int a[55]={0,-1,1,7,4,2,6,8,10,18,22,20,28,68}; int t,n; string s; int main(){ cin>>t; while(t--){ cin>>n,s=""; while(n>13&&n!=17)s+="8",n-=7; if(n==17)cout<<200<<s<<'\n'; else cout<<a[n]<<s<<'\n'; } }