#include <stdio.h>
#include <stdlib.h>

int main()
{
    int X,Y,jx,jy,dx,dy,sx,sy;
    scanf("%d%d",&X,&Y);
    if(X<10&&X>=1&&Y<10&&Y>=1){
        if(X>Y){
            printf("%d",X);
        }
        if(X<Y){
            printf("%d",Y);
        }
        if(X==Y){
            printf("%d%d",X,X);
        }
    }
    if(X>=10&&X<100&&Y>=10&&Y<100){
        jx=X%10;
        X/=10;
        dx=X%10;
        X/=10;
        jy=Y%10;
        Y/=10;
        dy=Y%10;
        Y/=10;
        if(dx==dy&&jx>jy){
            printf("%d%d%d",dx,dx,jx);
        }
        if(dx==dy&&jy>jx){
            printf("%d%d%d",dx,dx,jy);
        }
        if(dx>dy&&jx==jy){
            printf("%d%d%d",dx,jx,jx);
        }
        if(dy>dx&&jx==jy){
            printf("%d%d%d",dy,jx,jx);
        }
        if(dx==dy&&jx==jy){
            printf("%d%d%d%d",dx,dy,jx,jy);
        }
        if(dx>dy&&jx>jy){
            printf("%d%d",dx,jx);
        }
        if(dx<dy&&jx>jy){
            printf("%d%d",dy,jx);
        }
        if(dx>dy&&jx<jy){
            printf("%d%d",dx,jy);
        }
        if(dx<dy&&jx<jy){
            printf("%d%d",dy,jy);
        }
    }
    if((X<10&&X>=1&&Y>=10&&Y<100)||(X>=10&&X<100&&Y<10&&Y>=1)){
        jx=X%10;
        X/=10;
        dx=X%10;
        X/=10;
        jy=Y%10;
        Y/=10;
        dy=Y%10;
        Y/=10;
        if(dx>dy&&jx>jy){
            printf("%d%d",dx,jx);
        }
        if(dx<dy&&jx>jy){
            printf("%d%d",dy,jx);
        }
        if(dx>dy&&jy>jx){
            printf("%d%d",dx,jy);
        }
        if(dx<dy&&jy>jx){
            printf("%d%d",dy,jy);
        }
        if(dx>dy&&jx==jy){
            printf("%d%d%d",dx,jx,jx);
        }
        if(dy>dx&&jx==jy){
            printf("%d%d%d",dy,jx,jx);
        }
    }
    if(X<1000&&X>=100&&Y<1000&&Y>=100){
       jx=X%10;
        X/=10;
        dx=X%10;
        X/=10;
        sx=X%10;
        X/=10;
        jy=Y%10;
        Y/=10;
        dy=Y%10;
        Y/=10;
        sy=Y%10;
        Y/=10;
        if(sx==sy&&dx==dy&&jx>jy){
            printf("%d%d%d%d%d",sx,sx,dx,dx,jx);
        }
        if(sx==sy&&dx==dy&&jy>jx){
            printf("%d%d%d%d%d",sx,sx,dx,dx,jy);
        }
        if(sx==sy&&dx>dy&&jx==jy){
            printf("%d%d%d%d%d",sx,sx,dx,jx,jx);
        }
        if(sx==sy&&dy>dx&&jx==jy){
            printf("%d%d%d%d%d",sx,sx,dy,jx,jx);
        }
        if(sx==sy&&dx==dy&&jx==jy){
            printf("%d%d%d%d%d%d",sx,sx,dx,dy,jx,jy);
        }
        if(sx==sy&&dx>dy&&jx>jy){
            printf("%d%d%d%d",sx,sx,dx,jx);
        }
        if(sx==sy&&dx<dy&&jx>jy){
            printf("%d%d%d%d",sx,sx,dy,jx);
        }
        if(sx==sy&&dx>dy&&jx<jy){
            printf("%d%d%d%d",sx,sx,dx,jy);
        }
        if(sx==sy&&dx<dy&&jx<jy){
            printf("%d%d%d%d",sx,sx,dy,jy);
        }
        if(sx<sy&&dx==dy&&jx>jy){
            printf("%d%d%d%d",sy,dx,dx,jx);
        }
        if(sx<sy&&dx==dy&&jy>jx){
            printf("%d%d%d%d",sy,dx,dx,jy);
        }
        if(sx<sy&&dx>dy&&jx==jy){
            printf("%d%d%d%d",sy,dx,jx,jx);
        }
        if(sx<sy&&dy>dx&&jx==jy){
            printf("%d%d%d%d",sy,dy,jx,jx);
        }
        if(sx<sy&&dx==dy&&jx==jy){
            printf("%d%d%d%d%d",sy,dx,dy,jx,jy);
        }
        if(sx<sy&&dx>dy&&jx>jy){
            printf("%d%d%d",sy,dx,jx);
        }
        if(sx<sy&&dx<dy&&jx>jy){
            printf("%d%d%d",sy,dy,jx);
        }
        if(sx<sy&&dx>dy&&jx<jy){
            printf("%d%d%d",sy,dx,jy);
        }
        if(sx<sy&&dx<dy&&jx<jy){
            printf("%d%d%d",sy,dy,jy);
        }
        if(sx>sy&&dx==dy&&jx>jy){
            printf("%d%d%d%d",sx,dx,dx,jx);
        }
        if(sx>sy&&dx==dy&&jy>jx){
            printf("%d%d%d%d",sx,dx,dx,jy);
        }
        if(sx>sy&&dx>dy&&jx==jy){
            printf("%d%d%d%d",sx,dx,jx,jx);
        }
        if(sx>sy&&dy>dx&&jx==jy){
            printf("%d%d%d%d",sx,dy,jx,jx);
        }
        if(sx>sy&&dx==dy&&jx==jy){
            printf("%d%d%d%d%d",sx,dx,dy,jx,jy);
        }
        if(sx>sy&&dx>dy&&jx>jy){
            printf("%d%d%d",sx,dx,jx);
        }
        if(sx>sy&&dx<dy&&jx>jy){
            printf("%d%d%d",sx,dy,jx);
        }
        if(sx>sy&&dx>dy&&jx<jy){
            printf("%d%d%d",sx,dx,jy);
        }
        if(sx>sy&&dx<dy&&jx<jy){
            printf("%d%d%d",sx,dy,jy);
        }
    }
    return 0;
}