Smallest pallindrome

you are given an integer N find the smallest palindromic number of N digits that is divisible by 7

constrains
1<=T<=10
1<=N<=10^5

sample INPUT
2
3
4

sample OUTPUT
161
1001