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:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
A,B=map(str,raw_input().split())
listA=list(A)
listB=list(B)
for i in range(0,len(listA)):
	if listA[i]=="6":
		listA[i]="5"
for i in range(0,len(listB)):
	if listB[i]=="6":
		listB[i]="5"
minsum= int("".join(listA))+int("".join(listB))
listA=list(A)
listB=list(B)
for i in range(0,len(listA)):
	if listA[i]=="5":
		listA[i]="6"
for i in range(0,len(listB)):
	if listB[i]=="5":
		listB[i]="6"
maxsum= int("".join(listA))+int("".join(listB))
print minsum, maxsum