{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"Vinci is a little boy and is very creative. One day his teacher asked him to write all the Palindromic numbers from 1 to 1000. He became very frustrated because there is nothing creative in the task. Observing his expression, the teacher replied, \"All right then, you want hard stuff, you got it.\" Then he asks Vinci to write a palindromic number which is greater than the given number. A number is called palindromic when its digits are same from both sides.\n\nFor example: 1223221, 121, 232 are palindromic numbers but 122, 211, 332 are not. As there can be multiple solutions, Vinci has to find the number which is as small as possible."}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026le; 30)**, denoting the number of test cases.\n\nEach case starts with a line containing a positive integer. This integer can be huge and can contain up to **10\u003csup\u003e5\u003c/sup\u003e** digits."}},{"title":"Output","value":{"format":"MD","content":"For each case, print the case number and the minimum possible palindromic number which is **greater** than the given number."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\n121\n1\n1332331\n11\n1121\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: 131\nCase 2: 2\nCase 3: 1333331\nCase 4: 22\nCase 5: 1221\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"MD","content":"\u003cp class\u003d\"full\"\u003eDataset is huge, use faster I/O methods.\u003c/p\u003e"}}]}