{"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\u003eGiven an integer $$$n$$$, you have to change the minimum number of digits in it to form a legal SEVEN-number. A SEVEN-number is an integer which \u003cspan class\u003d\"tex-font-style-bf\"\u003edoes not have any leading zeroes\u003c/span\u003e and \u003cspan class\u003d\"tex-font-style-bf\"\u003eis divisible by $$$7$$$\u003c/span\u003e. For example, $133$ is a SEVEN-number, however, $077$ is not.\u003c/p\u003e\n\u003cp\u003eIf there are multiple ways to do it, print any of them. If the given number n is already divisible by $$$7$$$, keep it unchanged.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains one integer $$$t$$$ ($$$1 \\le t \\le 1000$$$) — the number of test cases.\u003c/p\u003e\n\u003cp\u003eIn the following $$$t$$$ lines, each line contains one integer $$$n$$$ ($$$10 \\le n \\le 1000$$$).\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, print one integer, the SEVEN-number after minimum number of digits changed in n.\u003c/p\u003e\n\u003cp\u003eIf there are multiple answers, print any of them. If the given number is already divisible by $$$7$$$, just print itself.\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\n49\n26\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, $$$49$$$ is already divisible by $$$7$$$.\n\u003cp\u003eIn the second test case of the example, there are multiple answers — $$$28$$$, $$$21$$$ or $$$56$$$.\u003c/p\u003e\n\u003cp\u003eIn the third test case of the example, other possible answers are $$$357$$$, $$$371$$$ and $$$378$$$. $$$Hint$$$: you \u003cspan class\u003d\"tex-font-style-bf\"\u003ecannot\u003c/span\u003e print $$$077$$$ or $$$77$$$.\u003c/p\u003e"}}]}