#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long x, y;
    cin >> x >> y;
    long long res = 0;
    long long mul = 1;
    while(x > 0 || y > 0) {
    	long long a = x % 10, b = y % 10;
    	if(a < b) swap(a, b);
    	res += a * mul;
    	mul *= 10;
    	if(a == b && x != 0 && y != 0) {
    		res += b * mul;
	    	mul *= 10;
    	}
    	x /= 10;
    	y /= 10;
    }
    cout << res;
    return 0;
}