while True:
try:
str = ''.join(input().split())
except:
break
else:
# 第二步奇偶排列
oushu = [str[x] for x in range(0,len(str),2)]
jishu = [str[x] for x in range(1,len(str),2)]
oushu.sort()
jishu.sort()
paixu = []
for i in range(len(str)):
n = int(i/2)
if i % 2 == 0:
paixu.append(oushu[n])
else:
paixu.append(jishu[n])
#第三步转换字符
for i in paixu:
try:
b=bin(int(i,16))[2:]
b = '0'*(4-len(b)) + b if len(b)<4 else b
b = b[::-1]
b = hex(int(b, 2))[2:].upper()
print(b,end='')
except:
print(i,end='')
print()