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


int main()
{
    int a, b, c, ia, ib, ic, da, db, dc, f = -1, s = -1, t = -1;
    short int na, nb, nc, ex = 0;

    scanf("%d %d %d",&a, &b, &c);

    ia = a;
    ib = b;
    ic = c;

    da = (int)log10(a);
    db = (int)log10(b);
    dc = (int)log10(c);

    while ((ia > 0 || ib > 0 || ic > 0) && ex == 0){
        na = (int)(ia / pow(10, da));
        nb = (int)(ib / pow(10, db));
        nc = (int)(ic / pow(10, dc));

        if(f < 0){
            if(na > nb && na > nc) f = a;
            else if(nb > na && nb > nc) f = b;
            else if(nc > na && nc > nb) f = c;
        }
        if(t < 0 && f >= 0){
            if(na < nb && na < nc) t = a;
            else if(nb < na && nb < nc) t = b;
            else if(nc < na && nc < nb) t = c;
            else if(f == a && b == c){
                t = b;
                s = c;
            }else if(f == b && a == c){
                t = a;
                s = c;
            }else if(f == c && a == b){
                t = a;
                s = b;
            }
        }
        if(s < 0 && t >= 0){
            if(a != f && a != t) s = a;
            else if(b != f && b != t) s = b;
            else if(c != f && c != t) s = c;
        }
        if(s >= 0) ex = 1;
        else{
            ia -= na * pow(10, da);
            ib -= nb * pow(10, db);
            ic -= nc * pow(10, dc);
            da--;
            db--;
            dc--;

        }
    }

    printf("%d%d%d",f,s,t);

    return 0;
}