#include <stdio.h>
#include <math.h>
int main () 
{
    long long int a, b, c, aa, bb, cc, x, y, z, co=1;
    scanf("%lld %lld %lld", &a, &b, &c);
    while(a!=b){
    aa=a;bb=b;
    while(aa=>bb*pow(10,co) || bb=>aa*pow(10,co)){
    aa/=10;
    bb/=10;
    }
    while(a>b)
    aa/=10;
    while(b>a)
    bb/=10;
    aa=aa%10;
    bb=bb%10;
    if(aa!=bb)
    break;
    co++;
    }
    if(aa>bb){
    x=a;
    y=b;}
    else{
    x=b;
    y=a;}
    co=1;
    while(b!=c){
    bb=b;cc=c;
    while(bb>=pow(10,co) && cc>=pow(10,co)){
    bb/=10;
    cc/=10;
    }
    bb=bb%10;
    cc=cc%10;
    if(bb!=cc)
    break;
    co++;
    }
    if(cc>=aa){
    z=y;
    y=x;
    x=c;}
    else if(cc>=bb){
    z=y;
    y=c;}
    else{
    z=c;}
    printf("%lld%lld%lld", x, y, z);
    return 0;
}