Read problems statements in Mandarin chinese, Russian and Vietnamese as well. 

Trans bought a calculator at creatnx's store. Unfortunately, it is fake. It has many bugs. One of them is adding two numbers without carrying. Example expression: 12 + 9 will have result 11 in his calculator. Given an expression in the form a + b, please output result from that calculator.
 
------ Input ------ 

The first line contains an integer T denote the number of test cases. Each test case contains two integers a, b in a single line.
 
------ Output ------ 

Each test case, print answer in a single line.
 
------ Constraints ------ 

$1 ≤ T ≤ 100$
$1 ≤ a, b ≤ 10^{9}$

Subtasks:

$Subtask #1 (30 points): 1 ≤ a, b ≤ 9$
$Subtask #2 (70 points): original constrains$

----- Sample Input 1 ------ 
2

12 9

25 25
----- Sample Output 1 ------ 
11

40

Source: codechef | Difficulty: EASY
Tags: Implementation


Solutions:
import math

def xsum(c, d):
	multiplier = 1
	bit_sum = 0
	res = 0
	while c or d:
		bit_sum = c % 10 + d % 10
		bit_sum = bit_sum % 10
		res = bit_sum * multiplier + res
		c = math.floor(c / 10)
		d = math.floor(d / 10)
		multiplier = multiplier * 10
	return res
for i in range(int(input())):
	(c, d) = map(int, input().split())
	print(xsum(c, d))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(s1, s) = (0, 1)
	while a > 0 or b > 0:
		q = a % 10
		w = b % 10
		s1 = s1 + s * ((q + w) % 10)
		s = s * 10
		a = a // 10
		b = b // 10
	print(s1)


for _ in range(int(input())):
	(a, b) = input().split()
	while len(a) < len(b):
		a = '0' + a
	while len(b) < len(a):
		b = '0' + b
	ans = ''
	for i in range(len(a)):
		ans += str((int(a[i]) + int(b[i])) % 10)
	ans = ans.lstrip('0')
	if ans:
		print(ans)
	else:
		print(0)


try:
	for _ in range(int(input())):
		(A, B) = map(int, input().split())
		s = 0
		for i in range(max(len(str(A)), len(str(B)))):
			a = A % 10
			b = B % 10
			s += (a + b) % 10 * 10 ** i
			A //= 10
			B //= 10
		print(s)
except:
	pass


def func(a, b):
	ans = 0
	tens = 0
	while a > 0 or b > 0:
		sum = (a % 10 + b % 10) % 10
		ans = 10 ** tens * sum + ans
		tens += 1
		a = a // 10
		b = b // 10
	return ans
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(func(a, b))


for t in range(int(input())):
	(a, b) = map(int, input().split())
	z = 0
	y = 0
	while a > 0 or b > 0:
		x = (a % 10 + b % 10) % 10
		a = a // 10
		b = b // 10
		y += x * 10 ** z
		z += 1
	print(y)


n = int(input())
for _ in range(n):
	l1 = []
	l2 = []
	l = list(map(int, input().split()))
	t = 1
	s1 = 0
	while l[0] != 0 or l[1] != 0:
		s = (l[0] % 10 + l[1] % 10) % 10
		s1 = t * s + s1
		t *= 10
		l[0] = l[0] // 10
		l[1] = l[1] // 10
	print(s1)


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	n = 0
	p = 1
	while a != 0 or b != 0:
		x = (a % 10 + b % 10) % 10
		n = x * p + n
		p *= 10
		a = a // 10
		b = b // 10
	print(n)
	t -= 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	a = str(a)
	b = str(b)
	m = abs(len(a) - len(b))
	if len(a) > len(b):
		b = '0' * m + b
	else:
		a = '0' * m + a
	l = []
	a = int(a)
	b = int(b)
	while a > 0 or b > 0:
		r1 = a % 10
		r2 = b % 10
		a = a // 10
		b = b // 10
		l.append(r1 + r2)
	l = l[::-1]
	c = ''
	for i in l:
		c += str(i % 10)
	if len(str(c)) > 1:
		print(c.lstrip('0'))
	else:
		print(c)


Z = int(input())
while Z:
	(num1, num2) = list(map(int, input().split()))
	(F, temp) = (10, 0)
	total = num1 + num2
	while num1 or num2:
		if num1 % 10 + num2 % 10 > 9:
			temp += F
		(num1, num2, F) = (num1 // 10, num2 // 10, F * 10)
	print(total - temp)
	Z -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	res = ''
	while a != 0 or b != 0:
		r1 = a % 10
		r2 = b % 10
		res = str((r1 + r2) % 10) + res
		a = a // 10
		b = b // 10
	print(int(res))


t = input()
for c in range(0, int(t)):
	a = list(map(str, input().split()))
	if len(a[0]) > len(a[1]):
		a[1] = a[1][::-1]
		a[1] += '0' * (len(a[0]) - len(a[1]))
		a[1] = a[1][::-1]
	elif len(a[1]) > len(a[0]):
		a[0] = a[0][::-1]
		a[0] += '0' * (len(a[1]) - len(a[0]))
		a[0] = a[0][::-1]
	c = ''
	for i in range(len(a[0])):
		b = ''
		b += str(int(a[0][i]) + int(a[1][i]))
		c += b[len(b) - 1]
	print(int(c))


tests = int(input())
for i in range(tests):
	(a, b) = map(str, input().split())
	maximum = max(len(a), len(b))
	a = '0' * (maximum - len(a)) + a
	b = '0' * (maximum - len(b)) + b
	ans = ''
	for j in range(maximum):
		temp = int(a[j]) + int(b[j])
		ans += str(temp % 10)
	print(int(ans))


for i in range(int(input())):
	(m, n) = map(int, input().split())
	a = list(str(m))
	b = list(str(n))
	l1 = len(a)
	l2 = len(b)
	sum2 = 0
	if l1 > l2:
		for j in range(abs(l1 - l2)):
			b.insert(0, '0')
	elif l2 > l1:
		for j in range(abs(l1 - l2)):
			a.insert(0, '0')
	d = max(l1, l2)
	for k in range(d):
		sum = int(a[k]) + int(b[k])
		if sum > 9:
			sum2 = sum2 + 10 ** (d - k)
	sum1 = m + n
	act_sum = sum1 - sum2
	print(act_sum)


for _ in range(int(input())):
	(a, b) = map(str, input().split())
	m = max(len(a), len(b))
	s = ''
	for i in range(m):
		(p, q) = (0, 0)
		if len(a) > i:
			p = a[-(i + 1)]
		if len(b) > i:
			q = b[-(i + 1)]
		s += str((int(p) + int(q)) % 10)
	print(int(s[::-1]))


def fun(a, b):
	num = 0
	n = 0
	while a or b:
		rem1 = a % 10
		rem2 = b % 10
		digit = rem1 + rem2
		digit = digit % 10
		num = digit * 10 ** n + num
		a = a // 10
		b = b // 10
		n += 1
	print(num)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	fun(a, b)


for _ in range(int(input())):
	(calci, iclac) = map(int, input().split())
	a = 0
	ans = 0
	while calci > 0 or iclac > 0:
		b = (calci % 10 + iclac % 10) % 10
		calci = calci // 10
		iclac = iclac // 10
		ans = b * 10 ** a + ans
		a += 1
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = 0
	ans = 0
	while a > 0 or b > 0:
		r = (a % 10 + b % 10) % 10
		a = a // 10
		b = b // 10
		ans = r * 10 ** c + ans
		c += 1
	print(ans)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	count = 0
	while a > 0 or b > 0:
		r = (a % 10 + b % 10) % 10
		a = a // 10
		b = b // 10
		ans = r * 10 ** count + ans
		count += 1
	print(ans)


for _ in range(int(input())):
	(a, b) = map(str, input().split())
	a = list(a)
	b = list(b)
	a = a[::-1]
	b = b[::-1]
	m = len(a)
	n = len(b)
	ans = 0
	if m >= n:
		for i in range(n):
			ans += (int(a[i]) + int(b[i])) % 10 * 10 ** i
		for i in range(n, m):
			ans += int(a[i]) * 10 ** i
		print(ans)
	elif m < n:
		for i in range(m):
			ans += (int(a[i]) + int(b[i])) % 10 * 10 ** i
		for i in range(m, n):
			ans += int(b[i]) * 10 ** i
		print(ans)


t = int(input().strip())
for p in range(t):
	(a, b) = input().strip().split()
	len_a = len(a)
	len_b = len(b)
	if len_a >= len_b:
		b = b.zfill(abs(len_a - len(b)) + len(b))
	else:
		a = a.zfill(abs(len_a - len(b)) + len(a))
	list_ans = []
	for i in range(len(a)):
		list_ans.append(float(a[i]) + float(b[i]))
		list_ans[i] = str(int(list_ans[i] % 10))
	print(int(''.join(list_ans)))


for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	s = 0
	l = []
	z = 0
	while a > 0 or b > 0:
		r1 = a % 10
		a = a // 10
		r2 = b % 10
		b = b // 10
		s = s * 10 + r1 + r2
		s = s % 10
		l.insert(0, s)
	for i in range(len(l)):
		z = z * 10 + l[i]
	print(z)


def buggy(a, b):
	p = 1
	sum = 0
	while a > 0 or b > 0:
		d = a % 10 + b % 10
		r = d % 10
		sum = sum + r * p
		p *= 10
		a = a // 10
		b = b // 10
	return sum
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(buggy(a, b))


from itertools import zip_longest

def solve(*args):
	(a, b) = args
	return int(''.join([str((int(x) + int(y)) % 10) for (x, y) in zip_longest(a[::-1], b[::-1], fillvalue=0)][::-1]))

def do_codechef():
	for t in range(int(input())):
		(a, b) = map(str, input().split(' '))
		print(solve(a, b))
do_codechef()
exit()


import math
n_tc = input()
mat = []
for i in range(int(n_tc)):
	bet = [int(item) for item in input().split()]
	mat.append(bet)
for alp in mat:
	tot = 0
	i = 0
	while alp[0] % 10 != alp[0] or alp[1] % 10 != alp[1]:
		a = alp[0] % 10
		b = alp[1] % 10
		tot = int((alp[0] + alp[1]) % 10 * math.pow(10, i)) + tot
		i = i + 1
		alp[0] = alp[0] // 10
		alp[1] = alp[1] // 10
	tot = int((alp[0] + alp[1]) % 10 * math.pow(10, i)) + tot
	print(tot)


for v in range(int(input())):
	(a, b) = map(int, input().split())
	(res, r) = ('', 0)
	if a == 0 or b == 0:
		print(a + b)
	else:
		while a != 0 or b != 0:
			res += str((a % 10 + b % 10) % 10)
			(a, b) = (a // 10, b // 10)
		print(int(res[::-1]))


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	c = 0
	t = 1
	while a != 0 or b != 0:
		c1 = a % 10
		c2 = b % 10
		a //= 10
		b //= 10
		c1 = c1 + c2
		c1 = c1 % 10
		c1 *= t
		c += c1
		t *= 10
	print(c)


T = int(input())
for _ in range(T):
	(N, K) = map(int, input().split())
	s1 = 0
	s = 1
	while N > 0 or K > 0:
		ans1 = N % 10
		ans2 = K % 10
		s1 = s1 + s * ((ans1 + ans2) % 10)
		s = s * 10
		N = N // 10
		K = K // 10
	print(s1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	s1 = 0
	s = 1
	while a > 0 or b > 0:
		c = a % 10
		d = b % 10
		s1 = s1 + s * ((c + d) % 10)
		s = s * 10
		a = a // 10
		b = b // 10
	print(s1)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	(z, m, s) = (0, 1, 0)
	while x or y:
		s = x % 10 + y % 10
		s = s % 10
		z += m * s
		m *= 10
		x //= 10
		y //= 10
	print(z)


p = int(input())
for i in range(p):
	(a, b) = map(int, input().split())
	s = 0
	count = 0
	while a > 0 or b > 0:
		m = (a % 10 + b % 10) % 10
		s = m * 10 ** count + s
		count += 1
		a = a // 10
		b = b // 10
	print(s)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	a = str(a)
	b = str(b)
	c = ''
	if len(a) > len(b):
		b = '0' * (len(a) - len(b)) + b
	if len(b) > len(a):
		a = '0' * (len(b) - len(a)) + a
	for i in range(len(a)):
		c = c + str((int(a[i]) + int(b[i])) % 10)
	print(int(c))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	p = 0
	while a > 0 or b > 0:
		t = (a % 10 + b % 10) % 10
		ans = t * 10 ** p + ans
		p += 1
		a = a // 10
		b = b // 10
	print(ans)


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	ans = 0
	c = 0
	while a > 0 or b > 0:
		r = (a % 10 + b % 10) % 10
		ans = r * 10 ** c + ans
		c += 1
		a = a // 10
		b = b // 10
	print(ans)
	t -= 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	string = ''
	while a > 0 or b > 0:
		string = str((a % 10 + b % 10) % 10) + string
		a = a // 10
		b = b // 10
	print(int(string))


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	s = 0
	for i in range(max(len(str(a)), len(str(b)))):
		c = a % 10
		d = b % 10
		s += (c + d) % 10 * 10 ** i
		a //= 10
		b //= 10
	print(s)


for T in range(int(input())):
	(a, b) = input().split()
	diff = abs(len(a) - len(b))
	if len(a) < len(b):
		a = '0' * diff + a
	else:
		b = '0' * diff + b
	res = 0
	for i in range(len(a)):
		res = res * 10 + (int(a[i]) + int(b[i])) % 10
	print(res)


t = int(input())
for _ in range(t):
	output = ''
	(x, y) = [int(i) for i in input().split()]
	while x > 0 or y > 0:
		if x > 0:
			num1 = x % 10
			x //= 10
		else:
			num1 = 0
		if y > 0:
			num2 = y % 10
			y //= 10
		else:
			num2 = 0
		num = (num1 + num2) % 10
		output += str(num)
	output = int(output[::-1])
	print(output)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	(c, m, s) = (0, 1, 0)
	while a or b:
		s = a % 10 + b % 10
		s = s % 10
		c += m * s
		m *= 10
		a //= 10
		b //= 10
	print(c)


import math

def xsum(a, b):
	mul = 1
	bit_sum = 0
	res = 0
	while a or b:
		bit_sum = a % 10 + b % 10
		bit_sum = bit_sum % 10
		res = bit_sum * mul + res
		a = math.floor(a / 10)
		b = math.floor(b / 10)
		mul = mul * 10
	return res
for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(xsum(a, b))


t = int(input())
for i in range(t):
	(A, B) = map(int, input().split())
	s = 0
	for i in range(max(len(str(A)), len(str(B)))):
		a = A % 10
		b = B % 10
		s += (a + b) % 10 * 10 ** i
		A //= 10
		B //= 10
	print(s)


import math

def xSum(n, m):
	res = 0
	multiplier = 1
	bit_sum = 0
	while n or m:
		bit_sum = n % 10 + m % 10
		bit_sum = bit_sum % 10
		res = bit_sum * multiplier + res
		n = math.floor(n / 10)
		m = math.floor(m / 10)
		multiplier = multiplier * 10
	return res
t = int(input())
while t > 0:
	(n, m) = map(int, input().split())
	print(xSum(n, m), end='\n')
	t = t - 1


T = int(input())
for iii in range(T):
	(a, b) = list(map(int, input().split()))
	su = ''
	a = str(a)
	b = str(b)
	if len(a) == len(b):
		for i in range(len(a) - 1, -1, -1):
			sz = str(int(a[i]) + int(b[i]))
			su = sz[-1] + su
	else:
		if len(a) > len(b):
			while len(b) != len(a):
				b = '0' + b
		elif len(b) > len(a):
			while len(b) != len(a):
				a = '0' + a
		for i in range(len(a) - 1, -1, -1):
			sz = str(int(a[i]) + int(b[i]))
			su = sz[-1] + su
	print(int(su))


def fun(a, b):
	s = ''
	while a != 0 or b != 0:
		s = str((a % 10 + b % 10) % 10) + s
		a //= 10
		b //= 10
	return int(s)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(fun(a, b))


T = int(input())

def buggy_calc(a, b):
	reminder = 0
	temp_a = a
	temp_b = b
	count = 0
	ans = 0
	while temp_a > 0 or temp_b > 0:
		reminder = (temp_a % 10 + temp_b % 10) % 10
		ans = 10 ** count * reminder + ans
		count += 1
		temp_a = temp_a // 10
		temp_b = temp_b // 10
	return ans
for tj in range(T):
	(a, b) = map(int, input().split())
	result = buggy_calc(a, b)
	print(result)