electicode
HomeCoursesResourcesProblemsNational OlympiadContestsLeaderboard
...

b + a or a + b

Time Limit: 1000msMemory Limit: 256MB
View Submissions

Problem Description

Since the standard addition operation is too complex to describe within this page, we will introduce our addition operation «+». The result of adding numbers AAA and BBB (denote it as A+BA+BA+B) will be the number obtained by appending BBB to the right of AAA. For example, 20+25=202520 + 25 = 202520+25=2025, and 25+20=252025 + 20 = 252025+20=2520. As you can see, A+BA + BA+B is not always equal to B+AB + AB+A, so find the smaller of the two.

That is, given AAA and BBB, you need to find the smallest of the numbers A+BA+BA+B and B+AB+AB+A.

Input Format

A single line contains two integers AAA and BBB (0<A,B<10000 < A, B < 10000<A,B<1000).

Output Format

Print a single number - the smallest of the numbers A+BA+BA+B and B+AB+AB+A.

Examples

Example 1
Input
20
25
Output
2025

© 2026 Electicode. All rights reserved.