{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003eLucky numbers are positive integers composed only of the digits ‘4’ and ‘7’. For example, \r\n47477 and 777 are lucky numbers while 457 and 1232 are not.\u003c/p\u003e\r\n\u003cp\u003eSuper lucky numbers have the following additional properties:\u003c/p\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eThey are a lucky number themselves.\u003c/li\u003e\r\n\u003cli\u003eNumber of digits in them is a lucky number.\u003c/li\u003e\r\n\u003cli\u003eThe number of ‘4’s or the number of ‘7’s in them is a lucky number (or both counts are lucky numbers).\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eA palindrome is an integer that reads the same forwards and backwards. For example, 547745\r\nand 343 are palindromes while 74 and 12345 are not. A super lucky palindrome is a positive\r\ninteger that is both a super lucky number and a palindrome.\u003c/p\u003e\r\n\u003cp\u003eGiven a number k, print the k-th smallest super lucky palindrome.\u003c/p\u003e\r\n\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003eThe first input line contains a positive integer, n, indicating the quantity of numbers to check.\u003c/p\u003e\r\n\u003cp\u003eEach of the next n lines contains a single integer, k (1 ≤ k ≤ 10^18).\u003c/p\u003e\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eFor each query, first output the heading “Query #d: ”, where d is the query number, starting with 1.\u003c/p\u003e\r\n\u003cp\u003eThen, for the value k given in the query, print the k-th smallest super lucky palindrome.\u003c/p\u003e\r\n\u003cp\u003eFollow the format illustrated in Sample Output.\u003c/p\u003e\r\n\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\r\n1\r\n2\r\n3\r\n5\r\n100\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eQuery #1: 4444\r\nQuery #2: 7777\r\nQuery #3: 4444444\r\nQuery #4: 4747474\r\nQuery #5: 44444444744744444444444444444444744744444444\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e"}}]}