def gcd(a, b):
    """greatest common dividier of a and b"""
    while(b != 0):
        tmp = a % b
        a = b
        b = tmp
    return a
#<input>
eq = input().replace(' ', '')
#</input>
#<parse>
lower = 'qwertyuiopasdfghjklzxcvbnm'
nums = '123456789'
l = len(eq.split("=")[0].split("+"))
prcomps = eq.split("=")[0].split("+") + eq.split("=")[1].split("+")
comps = prcomps[:]
#<brakets>
for i in range(len(comps)):
    if ('(' in comps[i]):
        b = comps[i].index('(')
        e = comps[i].index(')')
        mult = int(comps[i][e + 1:])
        inbr = comps[i][b + 1:e]
        j = 0
        while(j < len(inbr)):
            if(j != len(inbr) - 1 and inbr[j + 1] in lower):
                j += 1
            num = 1
            if(j != len(inbr) - 1 and inbr[j + 1] in nums):
                b = j + 1
                e = b
                while(e != len(inbr) and inbr[e] in nums):
                    e += 1
                num = int(inbr[b:e])
            num *= mult
            if (num == mult):
                inbr = inbr[:j + 1] + str(num) + inbr[j + 1:]
            else:
                inbr = inbr[:b] + str(num) + inbr[e + 1:]
            j += len(str(num)) + 1
        comps[i] = comps[i][:comps[i].index('(')] + inbr
#</brakets>
t = []
allelems = eq.replace('=', '').replace('+', '').replace('(', '').replace(')', '')
for i in range(10):
    allelems = allelems.replace(str(i), '')
while(allelems != ''):
    if (len(allelems) == 1):
        t.append(allelems)
        t = ''
    else:
        if(allelems[1] in lower):
            elem = allelems[:2]
        else:
            elem = allelems[0]
        t.append(elem)
        allelems = allelems.replace(elem, '')
elems = [{} for i in range(len(comps))]
for i in range(len(comps)):
    for elem in t:
        if(comps[i].count(elem) == 0):
            elems[i][elem] = 0
        else:
            if(comps[i].index(elem) + len(elem) == len(comps[i]) or comps[i][comps[i].index(elem) + len(elem)] not in nums):
                elems[i][elem] = 1
            else:
                j = comps[i].index(elem) + len(elem)
                while (j < len(comps[i]) and comps[i][j] in nums):
                    j += 1
                elems[i][elem] = int(comps[i][comps[i].index(elem) + len(elem):j])
#</parse>
#<matrix>
a = [[0 for i in range(len(elems))] for i in range(len(elems))]
b = [0 for i in range(len(a))]
b[0] = 3628800
a[0][0] = 1
for i in range(1, len(a)):
    for j in range(len(elems)):
        m = 1
        if (j >= l):
            m = -1
        a[i][j] = elems[j][t[i - 1]] * m
#</matrix>
#<solve>
for i in range(len(a) - 1):
    el = [abs(x[i]) for x in a]
    maxi = el[i:].index(max(el[i:])) + i
    (a[i], a[maxi]) = (a[maxi], a[i])
    (b[i], b[maxi]) = (b[maxi], b[i])
    for j in range(i + 1, len(a)):
        if (a[j][i] != 0):
            c = a[i][i] / a[j][i]
            for k in range(len(a[i])):
                a[j][k] *= c
            for k in range(len(a[i])):
                a[j][k] -= a[i][k]
            b[j] *= c
            b[j] -= b[i]
x = [0 for i in range(len(a))]
for i in range(len(a) - 1, -1, -1):
    for j in range(i + 1, len(a)):
        b[i] -= a[i][j]
        a[i][j] = 0
    x[i] = b[i] / a[i][i]
    for j in range(i):
        a[j][i] *= x[i]
#</solve>
#<gcd>
d = gcd(x[0], x[1])
for i in x[2:]:
    d = gcd(d, i)
for i in range(len(x)):
    x[i] = int(x[i] / d)
#</gcd>
#<check>
elem = t[-1]
c = 0
for i in range(len(comps)):
    m = 1
    if(i >= l):
        m = -1
    c += elems[i][elem] * x[i] * m
#</check>
#<print>
if (c == 0):
    for i in range(len(comps)):
        if (x[i] == 1):
            print(prcomps[i], end = ' ')
        else:
            print(x[i], prcomps[i], end = ' ')
        if(i == l - 1):
            print('=', end = ' ')
        elif(i != len(comps) - 1):
            print('+', end = ' ')
else:
    print('unbalancable')
#</print>
#<wait>
input()
#</wait>
