{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"### Read problems statements in [Mandarin Chinese](https://www.codechef.com/download/translated/COOK110/mandarin/MATCHES.pdf), [Russian](https://www.codechef.com/download/translated/COOK110/russian/MATCHES.pdf), [Vietnamese](https://www.codechef.com/download/translated/COOK110/vietnamese/MATCHES.pdf), and [Bengali](https://www.codechef.com/download/translated/COOK110/bengali/MATCHES.pdf) as well.\r\n\r\nChef\u0027s son Chefu found some matches in the kitchen and he immediately starting playing with them.\r\n\r\nThe first thing Chefu wanted to do was to calculate the result of his homework — the sum of $A$ and $B$, and write it using matches. Help Chefu and tell him the number of matches needed to write the result.\r\n\r\nDigits are formed using matches in the following way:\r\n![](CDN_BASE_URL/b650b1f0ce96b384081d88069927c85c?v\u003d1692491821)\r\n\r\n### Input\r\n- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.\r\n- The first and only line of each test case contains two space-separated integers $A$ and $B$.\r\n\r\n### Output\r\nFor each test case, print a single line containing one integer — the number of matches needed to write the result ($A+B$).\r\n\r\n### Constraints\r\n- $1 \\le T \\le 1,000$\r\n- $1 \\le A, B \\le 10^6$"}},{"title":"Sample 1","value":{"format":"MD","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\r\n123 234\r\n10101 1010\r\n4 4\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e13\r\n10\r\n7\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n**Example case 1:** The result is $357$. We need $5$ matches to write the digit $3$, $5$ matches to write the digit $5$ and $3$ matches to write the digit $7$.\r\n\r\n**Example case 2:** The result is $11111$. We need $2$ matches to write each digit $1$, which is $2 \\cdot 5 \u003d 10$ matches in total."}}]}