You have an electronic screen which can display decimal digits. Each decimal digit is composed of 7 segments which can be turned on and off. So you can use these 7 segments to combine into different decimal digits. The following picture describes how you can display all 10 decimal digits.
As you can see, different digits may require different number of segments to be turned on. For example, if you want to display 1, you have to turn on 2 segments of the screen, and if you want to display 8, all 7 segments should be turned on.
Assuming that you can only turn on no more than n segments at the same time, what is the largest positive integer you can display?
Note that you need to solve $T$ test cases.