def convert(s): 

  

    # initialization of string to "" 

    new = "" 

  

    # traverse in the string  

    for x in s: 

        new += x  

  

    # return string  

    return new 

n=eval(input())

ans=0

for i in range(len(n)):

  for j in range(len(n)-i):

    if j==len(n)-i-1:

      ans+=int(n[i])*(2**(len(n)-j-1))*(10**j)

    else:

      ans+=int(n[i])*(2**(len(n)-j-2))*(10**j)

print(ans)
def base10toN(num, base):

    converted_string, modstring = "", ""

    currentnum = num

    if not num:

        return '0'

    while currentnum:

        mod = currentnum % base

        currentnum = currentnum // base

        converted_string = chr(48 + mod + 7*(mod > 10)) + converted_string

    return converted_string

s=eval(input())

n=len(s)

ans=0

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

  t=base10toN(i,2)

  r=[]

  for j in range(n-1-len(t)):

    r.append('0')

  for j in range(len(t)):

    r.append(t[j])

  k=[]

  k.append(s[0])

  for j in range(n-1):

    if r[j]=='0':

      k.append(s[j+1])

    else:

      ans+=int(''.join(k))

      k=[]

      k.append(s[j+1])

  ans+=int(''.join(k))

print(ans)
def convert(s):
    # initialization of string to ""
    new = ""
    # traverse in the string
    for x in s:
        new += x
    # return string
    return new


n = eval(input())
ans = 0
for i in range(len(n)):
    for j in range(len(n) - i):
        if j == len(n) - i - 1:
            ans += int(n[i]) * (2 ** (len(n) - j - 1)) * (10**j)
        else:
            ans += int(n[i]) * (2 ** (len(n) - j - 2)) * (10**j)
print(ans)

def base10toN(num, base):
    converted_string, modstring = "", ""
    currentnum = num
    if not num:
        return "0"
    while currentnum:
        mod = currentnum % base
        currentnum = currentnum // base
        converted_string = chr(48 + mod + 7 * (mod > 10)) + converted_string
    return converted_string


s = eval(input())
n = len(s)
ans = 0
for i in range(2 ** (n - 1)):
    t = base10toN(i, 2)
    r = []
    for j in range(n - 1 - len(t)):
        r.append("0")
    for j in range(len(t)):
        r.append(t[j])
    k = []
    k.append(s[0])
    for j in range(n - 1):
        if r[j] == "0":
            k.append(s[j + 1])
        else:
            ans += int("".join(k))
            k = []
            k.append(s[j + 1])
    ans += int("".join(k))
print(ans)

-def convert(s): -    # initialization of string to "" -    new = "" -    # traverse in the string -    for x in s: -        new += x -    # return string -    return new +def base10toN(num, base): +    converted_string, modstring = "", "" +    currentnum = num +    if not num: +        return "0" +    while currentnum: +        mod = currentnum % base +        currentnum = currentnum // base +        converted_string = chr(48 + mod + 7 * (mod > 10)) + converted_string +    return converted_string -n = eval(input()) +s = eval(input()) +n = len(s) -for i in range(len(n)): -    for j in range(len(n) - i): -        if j == len(n) - i - 1: -            ans += int(n[i]) * (2 ** (len(n) - j - 1)) * (10**j) +for i in range(2 ** (n - 1)): +    t = base10toN(i, 2) +    r = [] +    for j in range(n - 1 - len(t)): +        r.append("0") +    for j in range(len(t)): +        r.append(t[j]) +    k = [] +    k.append(s[0]) +    for j in range(n - 1): +        if r[j] == "0": +            k.append(s[j + 1]) -            ans += int(n[i]) * (2 ** (len(n) - j - 2)) * (10**j) +            ans += int("".join(k)) +            k = [] +            k.append(s[j + 1]) +    ans += int("".join(k))