for i in range(5):
    def translator(arr):
        items=list(arr)
        s=[]
        for item in items:
            if item=="0":
                s.append("____")
            elif item=="1":
                s.append("___x")
            elif item=="2":
                s.append("__x_")
            elif item=="3":
                s.append("__xx")
            elif item=="4":
                s.append("_x__")
            elif item=="5":
                s.append("_x_x")
            elif item=="6":
                s.append("_xx_")
            elif item=="7":
                s.append("_xxx")
            elif item=="8":
                s.append("x___")
            elif item=="9":
                s.append("x__x")
            elif item=="A":
                s.append("x_x_")
            elif item=="B":
                s.append("x_xx")
            elif item=="C":
                s.append("xx__")
            elif item=="D":
                s.append("xx_x")
            elif item=="E":
                s.append("xxx_")
            elif item=="F":
                s.append("xxxx")
        return s


    line=input()
    s=translator(line)

    def r(n):
        return s[n-1]
    def c(n):
        return s[0][n-1]+s[1][n-1]+s[2][n-1]+s[3][n-1]

    def rule1():
        global s
        result=""
        if "_" not in r(1) and "_" not in r(2):
            s[0]="____"
            s[1]="____"
            result="B"
            return "+"+result
        elif "_" not in r(2) and "_" not in r(3):
            s[1]="____"
            s[2]="____"
            result="D"
            return "+"+result
        elif "_" not in r(3) and "_" not in r(4):
            s[2]="____"
            s[3]="____"
            result="~B"
            return "+"+result
        elif "_" not in c(1) and "_" not in c(2):
            s[0]="__"+s[0][2::]
            s[1]="__"+s[1][2::]
            s[2]="__"+s[2][2::]
            s[3]="__"+s[3][2::]
            result="A"
            return "+"+result
        elif "_" not in c(2) and "_" not in c(3):
            s[0]=s[0][0]+"__"+s[0][3]
            s[1]=s[1][0]+"__"+s[1][3]
            s[2]=s[2][0]+"__"+s[2][3]
            s[3]=s[3][0]+"__"+s[3][3]
            result="C"
            return "+"+result
        elif "_" not in c(3) and "_" not in c(4):
            s[0]=s[0][2::]+"__"
            s[1]=s[1][2::]+"__"
            s[2]=s[2][2::]+"__"
            s[3]=s[3][2::]+"__"
            result="~A"
            return "+"+result
        if result!="":
            return "+"+result
        else:
            return result


    def rule2():
        global s
        result=""
        if "_" not in r(1):
            s[0]="____"
            result="B~D"
            return "+"+result
        elif "_" not in r(2):
            s[1]="____"
            result="BD"
            return "+"+result
        elif "_" not in r(3):
            s[2]="____"
            result="~BD"
            return "+"+result
        elif "_" not in r(4):
            s[3]="____"
            result="~B~D"
            return "+"+result
        elif "_" not in c(1):
            s[0]="_"+s[0][1::]
            s[1]="_"+s[1][1::]
            s[2]="_"+s[2][1::]
            s[3]="_"+s[3][1::]
            result="A~C"
            return "+"+result
        elif "_" not in c(2):
            s[0]=s[0][0]+"_"+s[0][2::]
            s[1]=s[1][0]+"_"+s[1][2::]
            s[2]=s[2][0]+"_"+s[2][2::]
            s[3]=s[3][0]+"_"+s[3][2::]
            result="AC"
            return "+"+result
        elif "_" not in c(3):
            s[0]=s[0][0:2]+"_"+s[0][3]
            s[1]=s[1][0:2]+"_"+s[1][3]
            s[2]=s[2][0:2]+"_"+s[2][3]
            s[3]=s[3][0:2]+"_"+s[3][3]
            result="~AC"
            return "+"+result
        elif "_" not in c(4):
            s[0]=s[0][0:3]+"_"
            s[1]=s[1][0:3]+"_"
            s[2]=s[2][0:3]+"_"
            s[3]=s[3][0:3]+"_"
            result="~A~C"
            return "+"+result
        if result!="":
            return "+"+result
        else:
            return result


    def rule3():
        global s
        result=""
        if "_" not in r(1)[0:2] and "_" not in r(2)[0:2]:
            s[0]="__"+s[0][2::]
            s[1]="__"+s[1][2::]
            result="AB"
            return "+"+result
        elif "_" not in r(1)[1:3] and "_" not in r(2)[1:3]:
            s[0]=s[0][0]+"__"+s[0][3]
            s[1]=s[1][0]+"__"+s[1][3]
            result="BC"
            return "+"+result
        elif "_" not in r(1)[2::] and "_" not in r(2)[2::]:
            s[0]=s[0][0:2]+"__"
            s[1]=s[1][0:2]+"__"
            result="~AB"
            return "+"+result


        elif "_" not in r(2)[0:2] and "_" not in r(3)[0:2]:
            s[1]="__"+s[1][2::]
            s[2]="__"+s[2][2::]
            result="AD"
            return "+"+result
        elif "_" not in r(2)[1:3] and "_" not in r(3)[1:3]:
            s[1]=s[1][0]+"__"+s[1][3]
            s[2]=s[2][0]+"__"+s[2][3]
            result="CD"
            return "+"+result
        elif "_" not in r(2)[2::] and "_" not in r(3)[2::]:
            s[1]=s[1][0:2]+"__"
            s[2]=s[2][0:2]+"__"
            result="~AD"
            return "+"+result


        elif "_" not in r(3)[0:2] and "_" not in r(4)[0:2]:
            s[2]="__"+s[2][2::]
            s[3]="__"+s[3][2::]
            result="A~B"
            return "+"+result
        elif "_" not in r(3)[1:3] and "_" not in r(4)[1:3]:
            s[2]=s[2][0]+"__"+s[2][3]
            s[3]=s[3][0]+"__"+s[3][3]
            result="~BC"
            return "+"+result
        elif "_" not in r(3)[2::] and "_" not in r(4)[2::]:
            s[2]=s[2][0:2]+"__"
            s[3]=s[3][0:2]+"__"
            result="~A~B"
            return "+"+result
        if result!="":
            return "+"+result
        else:
            return result

    def rule4():
        global s
        result=""
        if r(1)[0]=="x" and r(1)[3]=="x" and r(2)[0]=="x" and r(2)[3]=="x":
            s[0]="_"+s[0][1:3]+"_"
            s[1]="_"+s[1][1:3]+"_"
            result="B~C"
            return "+"+result
        elif r(2)[0]=="x" and r(2)[3]=="x" and r(3)[0]=="x" and r(3)[3]=="x":
            s[1]="_"+s[1][1:3]+"_"
            s[2]="_"+s[2][1:3]+"_"
            result="~CD"
            return "+"+result
        elif r(3)[0]=="x" and r(3)[3]=="x" and r(4)[0]=="x" and r(4)[3]=="x":
            s[2]="_"+s[2][1:3]+"_"
            s[3]="_"+s[3][1:3]+"_"
            result="~B~C"
            return "+"+result
        elif c(1)[0]=="x" and c(1)[3]=="x" and c(2)[0]=="x" and c(2)[3]=="x":
            s[0]="__"+s[0][2::]
            s[3]="__"+s[3][2::]
            result="A~D"
            return "+"+result
        elif c(2)[0]=="x" and c(2)[3]=="x" and c(3)[0]=="x" and c(3)[3]=="x":
            s[0]=s[0][0]+"__"+s[0][3]
            s[3]=s[3][0]+"__"+s[3][3]
            result="C~D"
            return "+"+result
        elif c(3)[0]=="x" and c(3)[3]=="x" and c(4)[0]=="x" and c(4)[3]=="x":
            s[0]=s[0][0:2]+"__"
            s[3]=s[3][0:2]+"__"
            result="~A~D"
            return "+"+result
        if result!="":
            return "+"+result
        else:
            return result

    def rule5():
        global s
        result=""
        if s[0][0]=="x" and s[0][3]=="x" and s[3][0]=="x" and s[3][3]=="x":
            s[0]="_"+s[0][1:3]+"_"
            s[3]="_"+s[3][1:3]+"_"
            result="~C~D"
            return "+"+result
        if result!="":
            return "+"+result
        else:
            return result

    def rule6():
        global s
        result=""
        if s[0][0]=="x" and s[0][1]=="x":
            s[0]="__"+s[0][2::]
            result="AB~D"
            return "+"+result
        elif s[0][1]=="x" and s[0][2]=="x":
            s[0]=s[0][0]+"__"+s[0][3]
            result="BC~D"
            return "+"+result
        elif s[0][2]=="x" and s[0][3]=="x":
            s[0]=s[0][0:2]+"__"
            result="~AB~D"
            return "+"+result


        elif s[1][0]=="x" and s[1][1]=="x":
            s[1]="__"+s[1][2::]
            result="ABD"
            return "+"+result
        elif s[1][1]=="x" and s[1][2]=="x":
            s[1]=s[1][0]+"__"+s[1][3]
            result="BCD"
            return "+"+result
        elif s[1][2]=="x" and s[1][3]=="x":
            s[1]=s[1][0:2]+"__"
            result="~ABD"
            return "+"+result


        elif s[2][0]=="x" and s[2][1]=="x":
            s[2]="__"+s[2][2::]
            result="A~BD"
            return "+"+result
        elif s[2][1]=="x" and s[2][2]=="x":
            s[2]=s[2][0]+"__"+s[2][3]
            result="~BCD"
            return "+"+result
        elif s[2][2]=="x" and s[2][3]=="x":
            s[2]=s[2][0:2]+"__"
            result="~A~BD"
            return "+"+result



        elif s[3][0]=="x" and s[3][1]=="x":
            s[3]="__"+s[3][2::]
            result="A~B~D"
            return "+"+result
        elif s[3][1]=="x" and s[3][2]=="x":
            s[3]=s[3][0]+"__"+s[3][3]
            result="~BC~D"
            return "+"+result
        elif s[3][2]=="x" and s[3][3]=="x":
            s[3]=s[3][0:2]+"__"
            result="~A~B~D"
            return "+"+result


        elif s[0][0]=="x" and s[1][0]=="x":
            s[0]="_"+s[0][1::]
            s[1]="_"+s[1][1::]
            result="AB~C"
            return "+"+result
        elif s[1][0]=="x" and s[2][0]=="x":
            s[1]="_"+s[1][1::]
            s[2]="_"+s[2][1::]
            result="A~CD"
            return "+"+result
        elif s[2][0]=="x" and s[3][0]=="x":
            s[2]="_"+s[2][1::]
            s[3]="_"+s[3][1::]
            result="A~B~C"
            return "+"+result


        elif s[0][1]=="x" and s[1][1]=="x":
            s[0]=s[0][0]+"_"+s[0][2::]
            s[1]=s[1][0]+"_"+s[1][2::]
            result="ABC"
            return "+"+result
        elif s[1][1]=="x" and s[2][1]=="x":
            s[1]=s[1][0]+"_"+s[1][2::]
            s[2]=s[2][0]+"_"+s[2][2::]
            result="ACD"
            return "+"+result
        elif s[2][1]=="x" and s[3][1]=="x":
            s[2]=s[2][0]+"_"+s[2][2::]
            s[3]=s[3][0]+"_"+s[3][2::]
            result="A~BC"
            return "+"+result


        elif s[0][2]=="x" and s[1][2]=="x":
            s[0]=s[0][0:2]+"_"+s[0][3]
            s[1]=s[1][0:2]+"_"+s[1][3]
            result="~ABC"
            return "+"+result
        elif s[1][2]=="x" and s[2][2]=="x":
            s[1]=s[1][0:2]+"_"+s[1][3]
            s[2]=s[2][0:2]+"_"+s[2][3]
            result="~ACD"
            return "+"+result
        elif s[2][2]=="x" and s[3][2]=="x":
            s[2]=s[2][0:2]+"_"+s[2][3]
            s[3]=s[3][0:2]+"_"+s[3][3]
            result="~A~BC"
            return "+"+result


        elif s[0][3]=="x" and s[1][3]=="x":
            s[0]=s[0][0:3]+"_"
            s[1]=s[1][0:3]+"_"
            result="~AB~C"
            return "+"+result
        elif s[1][3]=="x" and s[2][3]=="x":
            s[1]=s[1][0:3]+"_"
            s[2]=s[2][0:3]+"_"
            result="~A~CD"
            return "+"+result
        elif s[2][3]=="x" and s[3][3]=="x":
            s[2]=s[2][0:3]+"_"
            s[3]=s[3][0:3]+"_"
            result="~A~B~C"
            return "+"+result

        if result!="":
            return "+"+result
        else:
            return result


    def rule7():
        global s
        result=""
        if s[0][0]=="x" and s[0][3]=="x":
            s[0]="_"+s[0][1:3]+"_"
            result="B~C~D"
            return "+"+result
        elif s[1][0]=="x" and s[1][3]=="x":
            s[1]="_"+s[1][1:3]+"_"
            result="B~CD"
            return "+"+result
        elif s[2][0]=="x" and s[2][3]=="x":
            s[2]="_"+s[2][1:3]+"_"
            result="~B~CD"
            return "+"+result
        elif s[3][0]=="x" and s[3][3]=="x":
            s[3]="_"+s[3][1:3]+"_"
            result="~B~C~D"
            return "+"+result


        elif s[0][0]=="x" and s[3][0]=="x":
            s[0]="_"+s[0][1::]
            s[3]="_"+s[3][1::]
            result="A~C~D"
            return "+"+result
        elif s[0][1]=="x" and s[3][1]=="x":
            s[0]=s[0][0]+"_"+s[0][2::]
            s[3]=s[3][0]+"_"+s[3][2::]
            result="AC~D"
            return "+"+result
        elif s[0][2]=="x" and s[3][2]=="x":
            s[0]=s[0][0:2]+"_"+s[0][3]
            s[3]=s[3][0:2]+"_"+s[3][3]
            result="~AC~D"
            return "+"+result
        elif s[0][3]=="x" and s[3][3]=="x":
            s[0]=s[0][0:3]+"_"
            s[3]=s[3][0:3]+"_"
            result="~A~C~D"
            return "+"+result

        if result!="":
            return "+"+result
        else:
            return result

    def rule8():
        global s
        result=""
        if s[0][0]=="x":
            s[0]="_"+s[0][1::]
            return "+AB~C~D"
        elif s[0][1]=="x":
            s[0]=s[0][0]+"_"+s[0][2::]
            return "+ABC~D"
        elif s[0][2]=="x":
            s[0]=s[0][0:2]+"_"+s[0][3]
            return "+~ABC~D"
        elif s[0][3]=="x":
            s[0]=s[0][0:3]+"_"
            return "+~AB~C~D"
        
        elif s[1][0]=="x":
            s[1]="_"+s[1][1::]
            return "+AB~CD"
        elif s[1][1]=="x":
            s[1]=s[1][0]+"_"+s[1][2::]
            return "+ABCD"
        elif s[1][2]=="x":
            s[1]=s[1][0:2]+"_"+s[1][3]
            return "+~ABCD"
        elif s[1][3]=="x":
            s[1]=s[1][0:3]+"_"
            return "+~AB~CD"

        elif s[2][0]=="x":
            s[2]="_"+s[2][1::]
            return "+A~B~CD"
        elif s[2][1]=="x":
            s[2]=s[2][0]+"_"+s[2][2::]
            return "+A~BCD"
        elif s[2][2]=="x":
            s[2]=s[2][0:2]+"_"+s[2][3]
            return "+~A~BCD"
        elif s[2][3]=="x":
            s[2]=s[2][0:3]+"_"
            return "+~A~B~CD"

        elif s[3][0]=="x":
            s[3]="_"+s[3][1::]
            return "+A~B~C~D"
        elif s[3][1]=="x":
            s[3]=s[3][0]+"_"+s[3][2::]
            return "+A~BC~D"
        elif s[3][2]=="x":
            s[3]=s[3][0:2]+"_"+s[3][3]
            return "+~A~BC~D"
        elif s[3][3]=="x":
            s[3]=s[3][0:3]+"_"
            return "+~A~B~C~D"
        return ""

    answer=""
    rules=[rule1,rule2,rule3,rule4,rule5,rule6,rule7,rule8]
    for i in range(len(rules)):
        while True:
            temp=rules[i]()
            if temp=="":
                break
            else:
                answer+=temp
    print(answer.strip("+"))