B = 0
for i in range(0, 100000):
K=1
A=0
x=i
while(x > 0):
if((x%10)%2 == 0):
A = A*10 +(x%10)
else:
K=K*10
B=B*10+(x%10)
x=x//10
A = A * K + B
if(A==26391):
print(i)
break