ZZZADD - Sleepy Addition 2

no tags 

Imagine a situation where you are feeling very sleepy and yet you have to add up two numbers mentally. In this situation it is better to try and estimate the value by rounding off the numbers into manageable values and then adding them up. You can't be bothered about deciding whether to round up or down therefore you always round it down to the nearest manageable number. Assume that you can manage a maximum of two non zero digits when you are sleepy.

If you were given to add 3 and 5, you will say 8. If you were given to add 55 and 61, this is again no problem for you, as you can manage two digits: you will answer 116. For larger numbers, say, if you have to add 1554 and 1323, you will round off 1554 into 1500, and 1323 into 1300 and then add them up to arrive at 2800. If you are given 13256 and 86552 you would round them up to 13000 and 86000 respectively and add them to produce 99000. 

You can't be bothered with more than this! If someone asks you to add two numbers which differ in order (say 1554 and 55) you will simply get angry and say "NO". However, if the larger number has consecutive zeros at the end it shouldn't be a problem, therefore if you get to 13300 and 56 you should say 13356.

Input

Two integers N and M separated by a space.
1 <= N <= 1000000000
1 <= M <= 1000000000 

Output

A single integer: the sleepy addition of N and M

Example

Input:
1554 1332

Output:
2800
Input:
55 61

Output:
116
Input:
1554 55

Output:
NO
Input:
14000 55

Output:
14055

hide comments
dsr: 2015-03-28 10:31:46

Interesting... Let me add this to my ToDo List!


Added by:Jakub Dostal
Date:2014-04-03
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All