s = eval(input())

l = len(s)

ans = 0



for i in range(2**(l-1)):

    f = ""

    for n in range(l):

        f += s[n]

        if (i>>n) & 1:

            f += "+"

    ans += eval(f)



print(ans)
s = eval(input())

l = len(s)

f = ""



for i in range(2**(l-1)):

    for n in range(l):

        f += s[n]

        if (i>>n) & 1:

            f += "+"

    f += "+"



f += "0"

print((eval(f)))
s = eval(input())
l = len(s)
ans = 0
for i in range(2 ** (l - 1)):
    f = ""
    for n in range(l):
        f += s[n]
        if (i >> n) & 1:
            f += "+"
    ans += eval(f)
print(ans)

s = eval(input())
l = len(s)
f = ""
for i in range(2 ** (l - 1)):
    for n in range(l):
        f += s[n]
        if (i >> n) & 1:
            f += "+"
    f += "+"
f += "0"
print((eval(f)))

-ans = 0 +f = "" -    f = "" -    ans += eval(f) -print(ans) +    f += "+" +f += "0" +print((eval(f)))