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
'''
#print 'Hello World!'

#Note - Biggest sum will come from the number with maximum number of 6s and closer the 6 to higher powers of 10 bigger the number
#  Lowest sum will come number with maximum number of 5s and closer the 5 is to power of 10 lower the number wrt the 6 counterpart.
# import time;

values=raw_input().strip().split(" ");    #"Enter the two values , num1 and num2:"

#start_time=time.time();
num1=str(values[0]);
num2=str(values[1]);

highestNum1=num1.replace('5','6'); # replace 5 with 6
highestNum2=num2.replace('5','6');

lowestNum1=num1.replace('6','5');
lowestNum2=num2.replace('6','5');

print int(lowestNum1)+int(lowestNum2), int(highestNum1)+int(highestNum2);

# print "Elapsed Time:", time.time()-start_time;