import sys
n = input()
b = []
count = 1
z = ""
for i in n:
b.append(i)
c = "".join(b).split(" ")
d = "".join(c) # 合并后的字符串
d_uneven = d[0::2] # dca
d_even = d[1::2] # efb
e_uneven = sorted(d_uneven) # ['a', 'c', 'd']
e_even = sorted(d_even) # ['b', 'e', 'f']
for i in e_even:
e_uneven.insert(count, i)
count = count + 2
e = "".join(e_uneven) # abcedf 11325
for i in e:
if i in "0123456789":
if i in "01":
f = bin(int(i)).split("b")
g = "00".join(f) # 0000 0001
h = g[::-1]
j = int(h, 2)
z = z + str(j)
elif i in "23":
ff = bin(int(i)).split("b")
gg = "0".join(ff) # 0010 0011
hh = gg[::-1]
jj = int(hh, 2)
if jj > 10:
jj1 = hex(jj)
jj2 = jj1[2:]
jj3 = jj2.upper()
z = z + jj3
else:
z = z + str(jj)
elif i in "4567":
fff = bin(int(i)).split("b")
ggg = "".join(fff)
hhh = ggg[::-1]
jjj = int(hhh, 2)
if jjj >= 10:
jjj1 = hex(jjj)
jjj2 = jjj1[2:]
jjj3 = jjj2.upper()
z = z + jjj3
else:
z = z + str(jjj)
elif i in "89":
ffff = bin(int(i))
gggg = ffff[2:]
hhhh = gggg[::-1]
jjjj = int(hhhh, 2)
z = z + str(jjjj)
elif i in "ABCDEFabcdef":
k = int(i, 16)
l = bin(int(k))
m = l[2:]
o = m[::-1]
p = int(o, 2)
if p > 10:
p1 = hex(p)
p2 = p1[2:]
p3 = p2.upper()
z = z + str(p3)
else:
z = z + str(p)
else:
z = z + i
print(z)
#字符串合并处理#