Problem: Big P is fairly good in mathematics.
His teacher has asked him to add two numbers.
Now , Big P has a problem that he sometimes writes a '6' as a '5' and vice versa.
Given two numbers, A and B, calculate the minimum and the maximum sum Big P could possibly get. 

Input:
The first and only line of input contains positive integers A and B . 

Output:
In single line of output, print two space separated integers, minimum and maximum sum Big P could get. 

Constraints:

1 ≤ A,B ≤ 1000000

SAMPLE INPUT
11 25

SAMPLE OUTPUT
36 37

Solution (in PYTHON):

Solution:
def max6(n):
	num=0
	flag=0
	if(n%10==0):
		n=n+1
		flag=1
	while n>0:
		if(n%10==5):
			num=num*10+6
		else:
			num=num*10+n%10
		n=n/10
	
	num=int(str(num)[::-1])
	if (flag==1):
		return num-1
	return num
	
def min5(n):
	num=0
	flag=0
	if(n%10==0):
		n=n+1
		flag=1
	while n>0:
		if n%10==6:
			num=num*10+5
		else:
			num=num*10+n%10
		n=n/10
	
	num=int(str(num)[::-1])
	if(flag==1):
		return num-1
	return num
	

n,m=(int(x) for x in raw_input().split())
print min5(n)+min5(m),max6(n)+max6(m)