{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eIn the Marvel-inspired coding universe, you are bestowed with an integer $$$n$$$, but there\u0027s a mystical quest ahead. Your mission, should you choose to accept it, is to alter the minimum number of digits in $$$n$$$ so that the transformed number has \u003cspan class\u003d\"tex-font-style-bf\"\u003eno leading zeroes\u003c/span\u003e and is imbued with the magical property of \u003cspan class\u003d\"tex-font-style-bf\"\u003ebeing divisible by 7\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eImagine you are the sorcerer\u0027s apprentice to Dr Strange, and your task is to manipulate the digits of $$$n$$$ using your magical powers. If $$$n$$$ is already blessed with the power of $$$7$$$, let it remain unchanged. However, if transformation is required, fear not, for you may choose any path to achieve this mystical goal. The universe is flexible, and \u003cspan class\u003d\"tex-font-style-bf\"\u003emultiple solutions exist\u003c/span\u003e; it\u0027s up to you to decide the magical incantations to transform $$$n$$$ into a number divinely divisible by $$$7$$$.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains one integer $$$t$$$ ($$$1 \\le t \\le 990$$$) — the number of test cases.\u003c/p\u003e\u003cp\u003eThen the test cases follow, each test case consists of one line containing one integer $$$n$$$ ($$$10 \\le n \\le 999$$$).\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, print one integer without any leading zeroes — the result of your changes (i. e. the integer that is divisible by $$$7$$$ and can be obtained by changing the minimum possible number of digits in $$$n$$$).\u003c/p\u003e\u003cp\u003eIf there are multiple ways to apply changes, print any resulting number. If the given number is already divisible by $$$7$$$, just print it.\u003c/p\u003e"}},{"title":"Sample 1","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\u003e3\n42\n23\n377\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e42\n28\n777\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eIn the first test case of the example, $$$42$$$ is already divisible by $$$7$$$, so there\u0027s no need to change it.\u003c/p\u003e\u003cp\u003eIn the second test case of the example, there are multiple answers — $$$28$$$, $$$21$$$ or $$$63$$$.\u003c/p\u003e\u003cp\u003eIn the third test case of the example, other possible answers are $$$357$$$, $$$371$$$ and $$$378$$$. Note that you \u003cspan class\u003d\"tex-font-style-bf\"\u003ecannot\u003c/span\u003e print $$$077$$$ or $$$77$$$.\u003c/p\u003e"}}]}