Problem:
 Score : 300 points    Problem Statement You are given a string S consisting of digits between 1 and 9 , inclusive.
You can insert the letter + into some of the positions (possibly none) between two letters in this string.
Here, + must not occur consecutively after insertion.  All strings that can be obtained in this way can be evaluated as formulas.  Evaluate all possible formulas, and print the sum of the results.      Constraints  1 \leq |S| \leq 10  All letters in S are digits between 1 and 9 , inclusive.         Input The input is given from Standard Input in the following format:  S       Output Print the sum of the evaluated value over all possible formulas.        Sample Input 1 125      Sample Output 1 176  There are 4 formulas that can be obtained: 125 , 1+25 , 12+5 and 1+2+5 . When each formula is evaluated,   125  1+25=26  12+5=17  1+2+5=8   Thus, the sum is 125+26+17+8=176 .       Sample Input 2 9999999999      Sample Output 2 12656242944

Solution (Python):
def calc(n):
    if n <= 1:
        return 1
    else:
        return 2 ** (n - 1)


def normailze(s, n):
    return (n - len(s)) * '0' + s


def solution(s):
    a = calc(len(s))
    cnt = 0
    n = len(s)
    if n ==1:
        return int(s)
    for i in range(a):
        binary = normailze(bin(i)[2:], n - 1)
        b = s[0]
        f = 1
        for j in binary:
            if int(j) == 1:
                cnt += int(b)
                b = s[f]
                f += 1
            else:
                b += s[f]
                f += 1
        cnt += int(b)
    return cnt

print(solution(input()))

Solution (Python):
import itertools
s=input()
ans=0
L=len(s)
for sta in itertools.product(range(2),repeat=L-1):  
  cut=[-1]+[i for i in range(L-1) if sta[i]]+[L-1]
  for i in range(len(cut)-1):
    ans+=int(s[cut[i]+1:cut[i+1]+1])
print(ans)

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

S = input()
N = len(S)

def dfs(i, f):
    
    if i == N - 1:
        return sum(list(map(int, f.split("+"))))
    return dfs(i + 1, f + S[i + 1]) + dfs(i + 1, f + "+" + S[i + 1])
print(dfs(0, S[0]))

Solution (Python):
s = input()
n,s = len(s),int(s)

ans=0
for i in range(2**(n-1)):
    num = s
    cut=1
    for j in range(n-1):
        if ((i>>j)&1):
            ans+=num%(10**cut)
            num=num//(10**cut)
            cut=1
        else:
            cut+=1
    ans+=num

print(ans)

Solution (Python):
S=str(input())
X=[int(i) for i in S]
n=len(X)-1
sum=0
s=''

for i in range(2**n):
    s=str(X[0])
    for j in range(n):
        if i>>j&1:
            sum+=int(s)
            s=str(X[j+1])
        else:
            s=s+str(X[j+1])
    else:
        sum+=int(s)
print(sum)

Solution (Python):
S = input()
ans = 0
for i in range(2**(len(S)-1)):
    s = ''
    for j in range(len(S)):
        s += S[j]
        if (i>>j) & 1: s+='+'
    ans+=eval(s)
print(ans)

Solution (Python):
s = input()
ans = 0
for i in range(2**(len(s)-1)):
    d = [(i >> j) & 1 for j in range(len(s)-1)]
    ans_ = 0
    tmp = int(s[0])
    for j in range(1, len(s)):
        if d[j-1]: tmp = tmp*10+int(s[j])
        else:
            ans_ += tmp
            tmp = int(s[j])
    ans += ans_ + tmp
print(ans)

Solution (Python):

import itertools
s= input() 
n = len(s)
zentan = itertools.product([0,1],repeat = n-1)
output = 0
for i in zentan: 
    total_i = 0
    ln = s[0]
    for j,k  in enumerate(i): 
        if k == 0:
            ln +=s[j+1]
        elif k == 1:
            total_i += int(ln)
            ln = s[j+1]
    total_i += int(ln)
    output += total_i
    
print(output)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

s = [int(i) for i in STR()]
l = len(s)
ans = 0
for i in range(2 ** (l - 1)):
    tmp = 0
    for j in range(l):
        tmp *= 10
        tmp += s[j]
        if i >> j & 1:
            ans += tmp
            tmp = 0
    ans += tmp
print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from itertools import product

s = read().rstrip().decode()
ans = int(s[-1]) * (2 ** (len(s) - 1))
for bit in product(['', '+'], repeat=len(s) - 1):
    memo = 0
    for i, (bf, af) in enumerate(zip(s, s[1:])):
        memo += int(bf)
        if bit[i] == '+':
            ans += memo
            memo = 0
        else:
            memo *= 10
    ans += memo
print(ans)

Solution (Python):
from itertools import product

s = str(input())
n = len(s)
s = list(s)

sum = 0
for bit in product([0,1],repeat=n-1):
    x = ["+"] * n
    siki = ""
    for i,j in enumerate(bit):
        
        if j == 1:
            x[i] = ""
    for k in range(n):
        if k != n-1:
            siki = siki + str(s[k])+str(x[k]) 
        else:
            siki = siki + str(s[k])
    sum += eval(siki)
print(sum)

Solution (Python):
from itertools import product

s = input()
n = len(s)

cnt = 0
for bit in product([0, 1], repeat=n - 1):
    tmp = []
    for i, j in enumerate(bit):
        if j == 1:
            tmp.append("+")
        else:
            tmp.append("")
    s_ = s[0]
    for i in range(n - 1):
        s_ += tmp[i] + s[i + 1]
    cnt += eval(s_)
print(cnt)

Solution (Python):
"""
abc167でC問題にてbit全探索を解けなかったので猛省
"""

N = list(input())

L = len(N)
ans = 0

for i in range(0, 1 << L-1):
    s = []
    minus = [N[0]]
    for j in range(L-1):
        if (i >> j) & 1:
            s.append(int("".join(minus)))
            minus = [N[j+1]]
        else:
            minus.append(N[j+1])
    s.append(int("".join(minus)))
    ans += sum(s)
print(ans)

Solution (Python):
def dfs(i,f):
    if i==n-1:
        return sum(list(map(int,f.split("+"))))

    return dfs(i+1,f+s[i+1])+dfs(i+1,f+"+"+s[i+1])

s=input()
n=len(s)

print(dfs(0,s[0]))

Solution (Python):
s=input()
sl=len(s)

if sl==1:
  print(int(s))
  exit()

ans=0
for i in range(2**(sl-1)):
  l=['' for j in range(sl-1)]
  for k in range(sl-1):
    if (i>>k)&1:
      l[k]='+'

  t_ans=0
  t_s=s[0]

  for k in range(1,sl):
    if l[k-1]=='+':
      t_ans+=int(t_s)
      t_s=s[k]
    else:
      t_s+=s[k]

  t_ans+=int(t_s)
  ans+=t_ans

print(ans)

Solution (Python):
s=input()
sl=len(s)

if sl==1:
  print(int(s))
  exit()

ans=0
for i in range(2**(sl-1)):
  l=['' for j in range(sl-1)]
  for k in range(sl-1):
    if (i>>k)&1:
      l[k]='+'

  t_ans=0
  t_s=s[0]

  for k in range(1,sl):
    if l[k-1]=='+':
      t_ans+=int(t_s)
      t_s=s[k]
    else:
      t_s+=s[k]

    if k==sl-1:
      t_ans+=int(t_s)

  ans+=t_ans

print(ans)

Solution (Python):
from itertools import groupby, accumulate, product, permutations, combinations

def solve():
    ans = 0
    S = list(map(int,list(input())))
    for p in product([0,1],repeat=len(S)-1):
        total = S[0]
        for i in range(len(S)-1):
            if p[i]==1:
                ans += total
                total = S[i+1]
            else:
                total *= 10
                total += S[i+1]
        ans += total
    return ans
print(solve())

Solution (Python):
S = input()
l = len(S)
ans = 0
for i in range(1<<(l-1)):
    tmp = 0
    for j in range(l):
        tmp = tmp*10+int(S[j])
        if i >> j & 1:
            ans += tmp
            tmp = 0
    ans += tmp
print(ans)

Solution (Python):
S = input()
l = len(S)
ans = 0
for i in range(1<<(l-1)):
    s = 0
    tmp = 0
    for j in range(l):
        tmp = tmp*10+int(S[j])
        if i >> j & 1:
            s += tmp
            tmp = 0
    ans += s + tmp
print(ans)

Solution (Python):
S=input()
s=list(S)

ans=0

if len(S)!=1:
    for i in range(2**(len(s)-1)):
        judge=str(bin(i))[2:].rjust(len(s)-1,"0")
        sum=0
        plus=s[0]
        
        for j,jud in enumerate(judge):
            if jud=="0":
                plus+=s[j+1]
                
            else:
                sum+=int(plus)
                plus=""
                plus+=s[j+1]
        if len(plus)!=0:
            sum+=int(plus)
            
        
        ans+=sum
else:
    ans=int(S)
print(ans)

Solution (Python):
S = input()

n = 2**(len(S)-1)
ans = 0
for i in range(n):
  bs ="0" + format(i,"0{}b".format(len(S)-1))
  res = 0
  l = []
  for j in range(len(bs)):
    if bs[j] == "1":
      l.append(int(S[res:j]))
      res = j
  l.append(int(S[res:len(S)]))
  ans += sum(l)
print(ans)

Solution (Python):
def main():
    import sys
    sys.setrecursionlimit(10 ** 7)

    s = input()

    def calc(cur=1, t=s[0]):
        if cur == len(s):
            return eval(t)
        return calc(cur + 1, t + s[cur]) + calc(cur + 1, t + '+' + s[cur])

    print(calc())


if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7


s=input().rstrip()
n=len(s)
plus=[[] for i in range(2**(n-1))]
for i in range(2**(n-1)):
    for j in range(n-1):
        x=(i>>j) %2
        
        if x==1:
            plus[i].append(j+1)
            
    plus[i].append(n)

ans=0
strs=[]
for i in range(2**(n-1)):
    strs=[]
    start=0
    endi=plus[i][0]
    '''print(start,end=" ")
    print(endi,end=" ")
    print(int(s[start:endi]))'''
    
    
    strs.append(int(s[start:endi]))
    for j in range(len(plus[i])-1):
        start=endi
        endi=plus[i][j+1]
        '''print(start,end=" ")
        print(endi,end=" ")
        print(int(s[start:endi]))'''
        strs.append(int(s[start:endi]))
    ans+=sum(strs)
print(ans)

Solution (Python):
from itertools import product
S = input().strip()
N = len(S)
cnt = 0
for x in product((0,1),repeat=N-1):
    y = S[0]
    for i in range(N-1):
        if x[i]==1:
            y += "+"
        y += S[i+1]
    cnt += eval(y)
print(cnt)

Solution (Python):

def main():
    S = list(input())
    lenS = len(S)-1

    ans = 0
    for i in range(2**lenS):
        Stmp = S.copy()
        jtmp = []
        for j in range(lenS):
            if (i>>j)&1:
                jtmp.append(j+1)
        for j in range(len(jtmp)):
            k = jtmp.pop()
            Stmp.insert(k, '+')
        listS = ''.join(Stmp).split('+')
        intS = [int(x) for x in listS]
        ans += sum(intS)

    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
def convert(s): 
  
    
    new = "" 
  
    
    for x in s: 
        new += x  
  
    
    return new 
n=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)

Solution (Python):
S = list(input())

res = 0
for i in range(2 ** (len(S) - 1)):
    s = S[0]
    for j in range(len(S) - 1):
        if i >> j & 1 == 1:
            s += "+"
        s += S[j + 1]
    res += eval(s)

print(res)

Solution (Python):
def dfs(i, f):
    if i == n - 1:
        return sum(list(map(int, f.split("+"))))

    
    return dfs(i + 1, f + s[i + 1]) + \
           dfs(i + 1, f + "+" + s[i + 1])


s = input()
n = len(s)

print(dfs(0, s[0]))

Solution (Python):
import itertools
s = input()
n = len(s) - 1

ans = 0
op = [x for x in itertools.product(["+", ""], repeat=n)]
for i in range(2 ** n):
  f = s[0]
  for j, k in zip(op[i], s[1:]):
    f += (j+k)
  ans += eval(f)
print(ans)

Solution (Python):
s = input()
l = len(s)-1
ans = 0

for j in range(2**l):
  L = 0
  for i in range(l):
    if (j>>i)&1 == 1:
      m = s[L:i+1]
      ans += int(m)
      L = i+1
  ans += int(s[L:])
print(ans)

Solution (Python):
def main():
    s = input()
    sukima = len(s)-1
    res = 0
    for i in range(2**sukima):
        op = ['']*sukima
        for j in range(sukima):
            if ((i>>j)&1): 
                op[sukima-1-j] = '+'
        s1 = [s[i//2] if i%2 == 0 else op[i//2] for i in range(len(s)*2-1)]
        res += eval(''.join(s1))
    print(res)
    
if __name__ == '__main__':
    main()

Solution (Python):
S = list(input())
N = len(S)

ans = 0
for i in range(2**(N-1)):
    siki = S[0]
    for j in range(N-1):
        if i>>j&1:
            siki += '+'
        siki += S[j+1]
    ans += eval(siki)
print(ans)

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

Solution (Python):
def resolve():
  ans = 0
  s = input()
  n = len(s)-1
  for i in range(1<<n):
    eq = ""
    for j in range(len(s)):
      eq += s[j]
      if (j < n and ((i>>j) & 1)):
        eq += "+"
    ans += eval(eq)
  print(ans)
  return

if __name__ == "__main__":
  resolve()

Solution (Python):
import sys
from itertools import product

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    S = input()
    n = len(S)
    res = 0
    for pattern in product([0, 1], repeat=n - 1):
        pattern = list(pattern) + [""]
        fomula = []
        for s, op in zip(S, pattern):
            fomula.append(s)
            fomula.append("+") if op == 1 else None

        fomula = "".join(fomula)
        res += eval(fomula)

    print(res)


if __name__ == '__main__':
    resolve()

Solution (Python):
S=input()
N=len(S)
n=N-1

ans=0
for b in range(2**n):
    pre=0
    for i in range(n):
        if b>>i&1==1:
            s=S[pre:i+1]
            ans+=int(s)
            pre=i+1
    ans+=int(S[pre:])
print(ans)

Solution (Python):
from itertools import product
def main():
    s = input()
    ans = 0
    for v in product([True, False], repeat=len(s)+1):
        if not v[0] or not v[len(s)]:
            continue
        l, r = 0, 1
        while r < len(s)+1:
            if v[r]:
                x = int(s[l:r])
                ans += x
                l = r
            r += 1
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
S = input()
op_cnt = len(S) - 1
ops = []
ans = 0
for i in range(2 ** op_cnt):
    op = [""] * op_cnt 
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = "+"
    formula = ""
    for p_n, p_o in zip(S, op + [""]):
        formula += (p_n + p_o)
    ans += eval(formula)

print(ans)

Solution (Python):
def main():
    S = input()
    N = len(S)-1
    ans = 0
    for bit in range(1 << N):
        op = ["" for _ in range(N)]
        for i in range(N):
            if bit & (1 << i):
                op[i] = "+"
        s = "".join(S[i]+op[i] for i in range(N)) + S[-1]
        ans += sum(int(t) for t in s.split('+'))
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
op_cnt = len(S) - 1  
ops = []
ans = 0
for i in range(2 ** op_cnt):
    op = [""] * op_cnt  
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = "+"  
    formula = ""
    for p_n, p_o in zip(S, op + [""]):  
        formula += (p_n + p_o)
    ans += eval(formula)

print(ans)

Solution (Python):
s = input()
n = len(s)
score = 0
for i in range(2**(n - 1)):
    temp = s[0]
    for j in range(n - 1):
        
        if (i>>j)&1:
            temp += '+' + s[j + 1]
        
        else:
            temp += s[j + 1]
    score += eval(temp)

print(score)

Solution (Python):
S = list(map(int, list(input())))
N = len(S) - 1
ans = 0
prev = 0
for i in range(2**N):
    prev = 0
    for j in range(N):
        prev *= 10
        prev += S[j]
        if (i >> j) % 2 == 1:
            ans += prev
            prev = 0
    prev *= 10
    prev += S[-1]
    ans += prev
print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

S = list(input())
N = len(S) - 1

ans = 0
for i in range(2 ** N):
    count = 0
    tmp = int(S[0])
    for j in range(N):
        if (i >> j) & 1:
            count += tmp
            tmp = int(S[j + 1])
        else:
            tmp = 10 * tmp + int(S[j + 1])
    count += tmp
    ans += count

print (ans)

Solution (Python):
def main():
    s = list(input())
    length = len(s)
    answer = 0
    for i in range(pow(2, length - 1)):
        op = ["" for _ in range(length - 1)]
        for j in range(length - 1):
            if (i >> j) & 1:
                op[j] = "+"
        formula = s[0]
        for j in range(length - 1):
            formula += op[j] + s[j + 1]
        answer += eval(formula)
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
N = len(S)

ans = 0
for d in range(1 << (N - 1)):
    ret = 0
    T = S[0]
    for i, s in enumerate(S[1:]):
        if (d & (1 << i)) > 0 and len(T) > 0:
            ret += int(T)
            T = ''
        T += s
    if len(T) > 0:
        ret += int(T)
    ans += ret
print(ans)

Solution (Python):
n = input()
l = len(n)
t = 0
for i in range(2**(l-1)):
	chk = [False] * (l)
	for j in range(l-1):
		if (i >> j) & 1:
			chk[j] = True
	v = ""
	for j in range(l):
		v += n[j]
		if chk[j]:
			v += ","
	u = v.split(",")
	for i in u:
		t += int(i)
print (t)

Solution (Python):
def dfs(i, f):
    if i == n - 1:
        return sum(list(map(int, f.split("+"))))

    
    return dfs(i + 1, f + s[i + 1]) + \
           dfs(i + 1, f + "+" + s[i + 1])


s = input()
n = len(s)

print(dfs(0, s[0]))

Solution (Python):
s=str(input())
S=[]
S[0:0]=s
for i in range(len(S)):
    S[i]=int(s[i])
t=0
for i in range(len(S)):
    p=len(S)-i-1
    for j in range(p):
        t+=S[i]*10**j*2**(len(S)-j-2)
    t+=S[i]*10**p*2**i
print(t)

Solution (Python):
s = input()
n = len(s)

def dfs(i , f):
    if i == n-1:
        return sum(list(map(int , f.split("+"))))
    
    return dfs(i+1 , f + s[i+1]) + dfs(i + 1 , f + "+" + s[i+1])

print(dfs(0 , s[0]))

Solution (Python):
S = str(input())
L = len(S)

lst = []
for i in range(2**(L-1)):
    lst.append(bin(i))
    lst[i] = lst[i][2:]
    lst[i] = lst[i].zfill(L-1)

res = []

for j in lst:
    lst_s = list(S)
    for k in range(L-1):
        if j[k] == "0":
            lst_s[k+1] = lst_s[k] + lst_s[k+1]
            lst_s[k] = "0"
        else:
            pass
    for l in range(L):
        lst_s[l] = int(lst_s[l])
    res.append(sum(lst_s))

print(sum(res))

Solution (Python):
s = input()
ans = 0
for i in range(2 ** (len(s) - 1)):
    fom_lst = []
    for j in range(len(s) - 1):
        if (i >> j & 1):
            fom_lst.append('+')
        else:
            fom_lst.append('')
    S = ''
    for num, fom in zip(s, fom_lst):
        S += num + fom
    S += s[-1]
    if '+' in S:
        ans += sum(map(int, S.split('+')))
    else:
        ans += int(S)

print(ans)

Solution (Python):
n = [int(x) for x in input()]
op_cnt = len(n)-1
sum =0
for i in range (2**op_cnt):
  op = ['']*op_cnt
  for j in range(op_cnt):
    if ((i >>j)&1):
      op[op_cnt-1-j] ='+'
  formula =''

  for p_n, p_o in zip(n, op+[""]):
    formula += (str(p_n) + p_o)
  sum +=eval(formula)

print(sum)

Solution (Python):
lst = [x for x in input()]
n = len(lst)
ret_lst = []


def hoge(idx, currnet):

    if idx == n:
        ret_lst.append(currnet)
    else:
        hoge(idx + 1, currnet + lst[idx])
        hoge(idx + 1, currnet + "+" + lst[idx])


hoge(1, lst[0])
ret = 0
for s in ret_lst:
    ret += sum([int(x) for x in s.split("+")])
print(ret)

Solution (Python):
import itertools

s = input()
n = len(s)

ans = 0
for v in itertools.product([0, 1], repeat=n-1):
    lst = list(v)
    idx = 0
    for i in range(n-1):
        if lst[i] == 1:
            ans += int(s[idx:i+1])
            idx = i + 1
    ans += int(s[idx:])
print(ans)

Solution (Python):
s=input()
n=len(s)-1
ans=0
for i in range(2**n):
  k=0
  for j in range(n):
    if ((i>>j) & 1):
      ans+=int(s[k:j+1])
      k=j+1
  ans+=int(s[k:])
print(ans)

Solution (Python):
from itertools import product
s = input()
l = len(s)
ans = 0
pat = list(product(['+', ''], repeat=l-1))
for i in range(2**(l-1)):
    fom = s[0]
    for j, k in zip(pat[i], s[1:]):
        fom += (j + k)
    ans += eval(fom)
print(ans)

Solution (Python):
def dfs(i,f):
    if i == n-1:
        return(sum(map(int,f.split('+'))))

    return dfs(i+1,f+s[i+1]) +\
               dfs(i+1,f+'+'+s[i+1])
s = input()
n = len(s)
print(dfs(0,s[0]))

Solution (Python):
s = input()
n = len(s)

t_list = []

for i in range(1<<(n-1)):
    t = ['' for _ in range(n)]
    for j in range(n):
        if (i >> j) & 1:
            t[j] = '+'
    t_list.append(t)

ans = 0

for i in t_list:
    formula = [x+y for x,y in zip(s,i)]
    formula = ''.join(formula)
    ans += eval(formula)
    
print(ans)

Solution (Python):
import itertools

s = input()
sum = 0

patern = [i for i in range(len(s)-1)]
pair = []
for i in range(0, len(patern)+1):
	pair += list(itertools.combinations(patern, i))

for lst in pair:
	start = 0
	for i in lst:
		sum += int(s[start:i+1])
		start = i+1
	sum += int(s[start:len(s)]) 


print(sum)

Solution (Python):
s = input()
n = len(s)


ans = 0
t_list = []
for i in range(2**(n-1)):
    t = ['' for _ in range(n)]
    for j in range(n-1):
        if (i >> j) & 1:
            t[j] = '+'
    t_list.append(t)


for i in range(2**(n-1)):
    formula = [i+j for i,j in zip(s,t_list[i])]
    formula = ''.join(formula)
    ans += eval(formula)
    
print(ans)

Solution (Python):
S = input()
count = 0


def calculate(isPlus):
    
    ans = 0
    start = 0
    for i in range(len(isPlus)):
        if isPlus[i]:
            
            ans += int(S[start:i+1])
            start = i+1
        if i == len(isPlus)-1:
            
            ans += int(S[start:])

    return ans


def recursion(depth, isPlus):
    global count
    if depth == len(S)-1:
        count += calculate(isPlus)
    else:
        recursion(depth=depth+1, isPlus=isPlus+[False])
        recursion(depth=depth+1, isPlus=isPlus+[True])


if len(S) == 1:
    print(S)
else:
    recursion(depth=0, isPlus=[])
    print(count)

Solution (Python):
s = input()

x = [list(map(int,bin(x)[2:].zfill(len(s)-1))) for x in range(2**(len(s)-1))]
ans = 0
sp1 = 0
sp2 = 0
for i in range(len(x)):
    for j in range(len(s)-1):
        if x[i][j]==1:
            sp1 = j+1
            ans += int(s[sp2:sp1])
            sp2 = sp1
    sp2=0
    ans += int(s[sp1:])
print(ans)

Solution (Python):
s = input()

ans = 0

for i in range(2**(len(s)-1)):
  f = s[0]
  for j in range(len(s)-1):
    if (i>>j)&1:
      f += '+'
    f += s[j+1]
  
  ans += eval(f)

print(ans)

Solution (Python):
def solve(input_s):
    length = len(input_s)
    ans = []
    
    def func(i, n):
        if i == length-1:
            ans.append(sum(map(int, n.split("+"))))
        else:
            func(i+1, n+"+"+input_s[i+1])
            func(i+1, n+input_s[i+1])

    func(0, input_s[0])
    return sum(ans)

if __name__ == "__main__":
    input_s = input()
    print(solve(input_s))

Solution (Python):
s=list(input())
n=len(s)
kotae=[]

def dfs(i,char):
  if i==n-1:
    kotae.append(sum(list(map(int,char.split("+")))))
  else:
    dfs(i+1,char+"+"+s[i+1])
    dfs(i+1,char+s[i+1])
dfs(0,s[0])
print(sum(kotae))

Solution (Python):
s=input()

l=len(s)-1

sums=[]

for i in range(2**l):

    inds=[0]

    for j in range(l):
      
        if (i>>j) & 1==1:
            inds.append(j+1)
            
    if len(inds)==1:
        sums.append(int(s))
    else:
        nums=[]
        
        for j in range(len(inds)-1):
            nums.append(int(s[inds[j]:inds[j+1]]))

        nums.append(int(s[inds[-1]:]))

        total=0
        for  n in nums:
            total+=n
        
        sums.append(total)
      
res=0
for n in sums:
    res+=n
  
print(res)

Solution (Python):
def resolve():
    S = input()
    total = int(S)
    for bits in range(1<<(len(S)-1)):
        _total = 0
        prev = 0
        for odr in range(len(S)-1):
            if (bits & (1<<odr)):
                _total += int(S[prev:odr+1])
                prev = odr+1
        if bin(bits).count("1") > 0 and len(S[prev:]) > 0:
            _total += int(S[prev:])
        total += _total
    print(total)


if '__main__' == __name__:
    resolve()

Solution (Python):
import math
import fractions



def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  
factinv = [1, 1]  
inv = [0, 1]  

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''










ss = input()
n = len(ss)
s=[]
for i in range(n):
    s.append(int(ss[i]))

ans = 0
for i in range(2**(n-1)):
    d=[[]]
    bit = ValueToBits(i,n-1)
    for j in range(n-1):
        d[-1].append(s[j])
        if(bit[j]==1):
            d.append([])
    d[-1].append(s[n-1])
    
    
    for j in d:
        for k in range(len(j)):
            ans += 10**(len(j)-1-k) * j[k]

            



print(ans)

Solution (Python):
import itertools
S=input()
N=len(S)-1
sum1=0

for i in itertools.product(["+",""],repeat=N):
    ans=""
    for x in range(N):
        if i[x]=="+":
            ans+=S[x]+i[x]
        else:
            ans+=S[x]
    ans+=S[-1]
    sum1+=eval(ans)
print(sum1)

Solution (Python):
import itertools
s=input()
ans=0
rep=len(s)-1

for i in itertools.product(["+", ""], repeat=rep):
    temp=""
    
    for j in range(rep):
        temp+=s[j]
        temp+=i[j]
    temp+=s[-1]
    ans+=eval(temp)
    

print(ans)

Solution (Python):
import itertools
s=list(input())
n=len(s)
sum1=0

for v in itertools.product(["+",""],repeat=n-1):
    a=""
    for i in range(n-1):
        if v[i]=='+':
            a+=s[i]+v[i]
        else:
            a+=s[i]
    
    a+=s[-1]
    sum1+=eval(a)
print(sum1)

Solution (Python):

from itertools import product
s = input()
n = len(s)
su = 0
l = list(product(["+",""], repeat=n-1))
for i in range(2**(n-1)):
  a = "0+"
  for j,k in zip(s,l[i]):
    a += j+k
  a += s[-1]

  su += eval(a)
print(su)

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

Solution (Python):
S = input()
plusi = len(S) - 1

total = 0
for i in range(2**plusi):
    prej = 0
    ret = []
    for j in range(plusi):
        if (i >> j) & 1:
            total += int(S[prej:j+1])
            prej = j + 1
    total += int(S[prej:plusi+1])
print(total)

Solution (Python):
s = input()
l = len(s)

patterns = []
for i in range(2**(l-1)):
    pattern = [''] * (l-1)
    for j in range(l-1):
        if (i >> j & 1):
            pattern[j] = '+'
    patterns.append(pattern)

ans = 0
for pattern in patterns:
    a = s[0]
    for i in range(l-1):
        if (pattern[i] == ''):
            a += s[i+1]
        else:
            ans += int(a)
            a = s[i+1]
    else:
        ans += int(a)

print(ans)

Solution (Python):
s=input()
n=len(s)
ans=0
k=pow(2,n-1)
i=0
while i<k:
    m=i
    sum=int(s[n-1])
    x=10
    p=n-2
    while p>-1:
        if m%2==0:
            sum+=int(s[p])*x
            x*=10
        else:
            sum+=int(s[p])
            x=10
        m=m//2
        p-=1
    ans+=sum
    i+=1
print(ans)

Solution (Python):
S=input()
N=len(S)-1
ans=0
if len(S)==1:
    print(S)
    exit()
for i in range(2**N):
    op=["-"]*N
    for j in range(N):
        if ((i>>j)&1):
            op[N-1-j]="+"
    
    l=[]
    tmp=""
    for k in range(N):
        tmp=tmp+S[k]
        if k==(N-1):
            if op[k]=="+":
                l.append(tmp)
                l.append(S[-1])
            else:
                tmp=tmp+S[-1]
                l.append(tmp)
            break
        if op[k]=="+":
            l.append(tmp)
            tmp=""
        else:
            pass
    
    for k in range(len(l)):
        val=int(l[k])
        ans+=val

print(ans)

Solution (Python):
s = list(input())
l = len(s)-1
li = ["+",0]
L = [0]*(l)

from itertools import product
sum1 = 0
for v in product(li,repeat = l):
    a = ""
    for i in range(l):
        if v[i] == "+":
            a += s[i] + (v[i])
        else:
            a +=s[i]
    a +=s[-1]
    sum1 += eval(a)
print(sum1)

Solution (Python):

s = input()

ans = 0
for i in range(2 ** (len(s) - 1)):
    pat = s[0]
    index = 1
    for j in range(len(s) - 1):
        if i >> j & 1:
            pat += "+"
        pat += s[index]
        index += 1
    
    ans += eval(pat)

print(ans)

Solution (Python):
import sys
readline = sys.stdin.readline

def main():
    S = readline().rstrip()
    N = len(S)
    ans = 0
    for i in range(2**(N-1)):
        b = bin(i)[2:].zfill(N-1)
        f = [S[i]+'+' if b[i]=='1' else S[i] for i in range(N-1)]
        f += S[-1]
        ans += eval(''.join(f))
    
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

"""
Created on Thu Apr 23 02:13:44 2020

@author: Kanaru Sato
"""

s = input()
n = len(s)

count = 0

for state in range(2**(n-1)):
    nums = s
    for i in range(n-1):
        if state & (1<<i):
            nums = nums[:n-1-i]+"+"+nums[n-1-i:]
    count += sum(map(int, nums.split("+")))

print(count)

Solution (Python):
S = list(map(int,list(input())))
N = len(S)
ans = 0
for i in range(2 ** (N - 1)):
    cnt = 0
    temp = S[0]
    for j in range(N - 1):
        flag = i & 1
        if flag:
            cnt += temp
            temp = S[j + 1]
        else:
            temp = temp * 10 + S[j + 1]
        i >>= 1
    ans += cnt + temp
print(ans)