First and Last Digit Problem Code: FLOW004 (CodeChef)

If Give an integer N . Write a program to obtain the sum of the first and last digits of this number.

Input

The first line contains an integer T, the total number of test cases. Then follow T lines, each line contains an integer N.

Output

For each test case, display the sum of first and last digits of N in a new line.

Constraints

  •  T  1000
  •  N  1000000

Example

Input
3 
1234
124894
242323

Output
5
5
5
Solution
t=int(input())
for i in range (t):
    s=input()
    print(int(s[0])+int(s[-1]))
    

Comments

Popular posts from this blog

Sort in specific order (GFG)

Chef and Remissness Problem Code: REMISS (CodeChef)

Short Notes Of computer Network