SP21057 CTPLUCKY - Super Lucky Palindromes

Description

Lucky numbers are positive integers composed only of the digits ‘4’ and ‘7’. For example,

Input Format

The first input line contains a positive integer, n, indicating the quantity of numbers to check. Each of the next n lines contains a single integer, k (1

Output Format

For each query, first output the heading “Query #d: ”, where d is the query number, starting with 1. Then, for the value k given in the query, print the k-th smallest super lucky palindrome. Follow the format illustrated in Sample Output.