Seven segment display

3.3

3 votes
Problem

Kancha wants to participate in a new event of Technobyte. Event says that you have to write a number in seven segment display using matchsticks. Please refer to the diagram below for how many sticks are used for each digit !!

Each digit as written in seven segment display

Now, event coordinator gave kancha a long string. your task is to tell how many matchsticks will be used in writing that number as in the seven segment display !!

Input: First line of input contains an integer t, then t lines follow each containing a number less than 10^5 digits !

Output: Print one line containing the integer denoting the number of matchsticks used.

Constraints: 0<t <=10 0<=Input number<=10^(10^5)

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

1 takes 2 sticks 3 takes 5 sticks 5 takes 5 sticks 7 takes 3 sticks 9 takes 6 sticks Total = 21 sticks

Editor Image

?