#P6500. [COCI 2010/2011 #3] ZBROJ

[COCI 2010/2011 #3] ZBROJ

Description

The teacher gave Perica two numbers aa and bb. Perica copied them into his notebook and wants to compute their sum.

While copying, Perica might mistakenly copy the digit 66 in aa or bb as 55, or mistakenly copy the digit 55 as 66. Of course, he might also copy them correctly.

Given aa and bb, find the minimum and maximum possible values of the sum Perica computed.

Input Format

The input contains only one line with two integers, which are aa and bb.

Output Format

Output one line with two integers: the minimum possible sum and the maximum possible sum.

11 25

36 37
1430 4862

6282 6292

16796 58786

74580 85582

Hint

Constraints

For all testdata, it is guaranteed that 1a,b1061 \leq a, b \leq 10^6.

Notes

This problem is translated from COCI2010-2011 CONTEST #3 T2 ZBROJ.

Translated by ChatGPT 5