a=int(input())
x=a+1000
w=[0,0,0]
w[0]=x%10
x=x//10
w[1]=x%10
x=x//10
w[2]=x%10

flag=0
for i in range(2):
    if w[i]==w[i+1]:
        pass
    else:
        flag+=1

if flag==0:
    print(a)
else:
    w=sorted(w)
   
    e=1
    a=0
    for i in range(3):
       a+=w[2]*e
       e*=10
    print(a)








