#P6500. Perica's Mistaken Calculations

    ID: 19714 Type: Default 1000ms 256MiB

Perica's Mistaken Calculations

Perica's Mistaken Calculations

Perica was given two numbers \(a\) and \(b\) by his teacher and wrote them down in his notebook. However, while copying the numbers, he might mistakenly confuse the digits \(6\) and \(5\): sometimes copying a \(6\) as a \(5\) and sometimes a \(5\) as a \(6\) (or he might copy them correctly). Given the original numbers \(a\) and \(b\), determine the minimum and maximum possible sums that Perica might calculate.

The minimum sum is obtained by replacing every ambiguous digit with \(5\) (i.e., change every \(6\) to \(5\)). The maximum sum is obtained by replacing every ambiguous digit with \(6\) (i.e., change every \(5\) to \(6\)).

inputFormat

The input consists of a single line with two numbers \(a\) and \(b\) separated by a space. Both numbers are given in their original form.

outputFormat

Output two integers separated by a space: the minimum sum and the maximum sum that Perica might calculate.

sample

11 25
36 37