<reponame>arpit1920/Python-Codechef-Problems
'''
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
1 ≤ T ≤ 1000
1 ≤ N ≤ 1000000
Example
Input
3 
1234
124894
242323

Output
5
5
5
'''

t=int(input())
a=""
sum=0
for i in range(0,t):
   a=int(input())

   b = str(a)
   l = len(b)
   c = b[:1]
   d = b[l - 1:l]
   sum = int(c) + int(d)
   print(sum)
'''
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
1 ≤ T ≤ 1000
1 ≤ N ≤ 1000000
Example
Input
3 
1234
124894
242323

Output
5
5
5
'''

t=int(input())
a=""
sum=0
for i in range(0,t):
   a=int(input())

   b = str(a)
   l = len(b)
   c = b[:1]
   d = b[l - 1:l]
   sum = int(c) + int(d)
   print(sum)
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
 1 ≤ T ≤ 1000
 1 ≤ N ≤ 1000000
 Example
 Input
 3 
 1234
 124894
 242323
 
 Output
 5
 5
 5