mystery-11
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Solve the mystery

HINT : Digital Display
Input :
First line has an integer T.
Next T lines has an integer N in each line. It is guaranteed that N never starts with 0 unless value is equal to zero.

Output :
Print the output for each test case in new line.

Constraints :
1 ≤ T ≤ 1000
0 ≤ |N| ≤ 1000
|N| is number of digits.

Problem Setter : Vinay Kumar

SAMPLE INPUT
8
1234567
123456
1234
193
12
11
1
0

SAMPLE OUTPUT
30
27
16
13
7
4
2
6


arr=[6,2,5,5,4,5,6,3,7,6]
for _ in range(eval(input())):
	a=list(input())
	temp=0

	for item in a:
		temp=temp+arr[int(item)]
		
	print(temp) 


t=int(eval(input()))
while t>0:
	s=input()
	n=0
	for i in range(len(s)):
		if s[i]=='0':
			n=n+6
		elif s[i]=='1':
			n=n+2
		elif s[i]=='2':
			n=n+5
		elif s[i]=='3':
			n=n+5
		elif s[i]=='4':
			n=n+4
		elif s[i]=='5':
			n=n+5
		elif s[i]=='6':
			n=n+6
		elif s[i]=='7':
			n=n+3
		elif s[i]=='8':
			n=n+7
		else:
			n=n+6
	print(n)
	t=t-1
		


def mystery_prob():
	a=[6,2,5,5,4,5,6,3,7,6]
	t=eval(input())
	for tc in range(t):
		x=input()
		ans=0
		for m in x:
			ans=ans+a[(int(m))]
		print(ans)
mystery_prob()
			


t=eval(input())
n=[ '' for x in range(100)]
for x in range(t):
	n=input('')
	count=0
	for a in range(0,len(n)):
		if n[a]=='1':
			count=count+2
		elif n[a]=='2':
			count=count+5
		elif n[a]=='3':
			count=count+5
		elif n[a]=='4':
			count=count+4
		elif n[a]=='5':
			count=count+5
		elif n[a]=='6':
			count=count+6
		elif n[a]=='7':
			count=count+3
		elif n[a]=='8':
			count=count+7
		elif n[a]=='9':
			count=count+6
		elif n[a]=='0':
			count=count+6
	print(count)


def solve():
	a = [6,2,5,5,4,5,6,3,7,6]
	t = eval(input())
	for tt in range(t):
		s = input()
		res = 0
		for i in s:
			res += a[(int(i))]
		print(res)
solve()


d=[[1,2], [2,5], [3,5], [4,4], [5,5], [6,6], [7,3], [8,7], [9,6], [0,6]]
d=dict(d)
t=int(eval(input()))
for tc in range(t):
	n=str(eval(input()))
	sum=0
	for i in n:
		sum=sum+d[int(i)]
	print(sum)


def digital(t):
	dc = 0
	while dc < t:
		dic = {'0':6, '1':2, '2':5, '3':5, '4':4, '5':5, '6':6, '7':3, '8':7, '9':6}
		s = input()
		sum = 0
		for e in s:
			sum = sum + dic[e]
		print(sum)
		dc += 1
t = int(input())        
digital(t)