{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"Chef\u0027s son Chefu found some matches in the kitchen and he immediately starting playing with them.\u003cbr\u003e\u003cbr\u003e\n\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.\u003cbr\u003e\u003cbr\u003e\n\nDigits are formed using matches in the following way:"}},{"title":"","value":{"format":"HTML","content":"\u003ca href\u003d\"https://codechef_shared.s3.amazonaws.com/download/Images/COOK110/MATCHES/97JCfQw.gif\"\u003eClick here to see the picture\u003c/a\u003e"}},{"title":"","value":{"format":"HTML","content":"Input\u003cbr\u003e\u003cbr\u003e\nThe first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.\nThe first and only line of each test case contains two space-separated integers A and B."}},{"title":"","value":{"format":"HTML","content":"Output\u003cbr\u003e\u003cbr\u003e\nFor each test case, print a single line containing one integer — the number of matches needed to write the result (A+B)."}},{"title":"","value":{"format":"HTML","content":"Constraints\u003cbr\u003e\u003cbr\u003e\n1≤T≤1,000\u003cbr\u003e\n1≤A,B≤10^6"}},{"title":"","value":{"format":"HTML","content":"Example Input\u003cbr\u003e\u003cbr\u003e\n3\u003cbr\u003e\n123 234\n\u003cbr\u003e10101 1010\n\u003cbr\u003e4 4"}},{"title":"","value":{"format":"HTML","content":"Example Output\u003cbr\u003e\u003cbr\u003e\n13\u003cbr\u003e\n10\u003cbr\u003e\n7\u003cbr\u003e"}},{"title":"","value":{"format":"HTML","content":"Explanation\u003cbr\u003e\nExample 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.\u003cbr\u003e\u003cbr\u003e\n\nExample case 2: The result is 11111. We need 2 matches to write each digit 1, which is 2⋅5\u003d10 matches in total.\u003cbr\u003e"}}]}