Under construction

Still being built. Things may change

Difference Between 5 and 6

Interview

Time limit1sMemory limit128 MB

Summary
Given two integers, compute the minimum and maximum possible sums after freely swapping digits 5 and 6 in each number.
Level

Easy2 of 10

Topics
String, Greedy, Implementation
Solved
No attempts yet

Problem

A person may confuse the digits 5 and 6. When reading a 5, they may see it as 5 or mistakenly as 6; when reading a 6, they may see it as 6 or mistakenly as 5.

Given two integers A and B, there are several possible values for A+B under this reading. Find the minimum and maximum possible sums.

Input

The first line contains two integers A and B. (1 <= A, B <= 1,000,000)

Output

Print the minimum and maximum possible sums, separated by a space.

Examples3

  1. Example 1

    Input
    11 25
    
    Expected output
    36 37
    
  2. Example 2

    Input
    1430 4862
    
    Expected output
    6282 6292
    
  3. Example 3

    Input
    16796 58786
    
    Expected output
    74580 85582