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):
a=input()
l=len(a)
ans=0

for i in range(2**(l-1)):
    i=("0"*l+bin(i)[2:])[-l+1:]
    cnt=a[0]
    for j in range(l-1):
        if i[j]=="0":
            cnt+=a[j+1]
        else:
            ans+=int(cnt)
            if j<l-1:
                cnt=a[j+1]
            else:
                cnt=""
    if cnt!="":
        ans+=int(cnt)
print(ans)

Solution (Python):
import sys
import  math
import bisect
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

s = input()
li = [int(x) for x in s]
l = len(s)
ans = 0
if l == 1:
    print(li[0])
else:
    for i in range(1 << (l - 1)):
        k = li[0]
        ct = 0
        for j in range(l - 1):
            if i >> j & 1:
                ct += k
                k = li[j + 1]
            else:
                k = k * 10 + li[j + 1]
            if j == l - 2:
                ct += k
                ans += ct
    print(ans)

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

a = []

for i in range(2 ** (l-1)):
    f = []
    b = '{:b}'.format(i).zfill(l-1)
    for j, c in enumerate(s):
        f.append(c)
        if j < l-1 and b[j] == '1':
        	f.append('+')
    a.append(eval(''.join(f)))

print(sum(a))

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

sum = 0
for i in range(1 << (length - 1)):
    s = S[0]
    for j in range(length - 1):
        if i & (1 << j):
            s += "+"
        s += S[j + 1]
    sum += eval(s)
print(sum)

Solution (Python):
import itertools
S = input()
op = list(itertools.product('+ ', repeat=len(S)-1))
calcs = []
for i in range(len(op)):
  calc = ""
  for j in range(len(S)-1):
    calc += S[j] + op[i][j]
  calc += S[-1]
  calcs.append(calc)

for i in range(len(calcs)):
  calcs[i] = eval(calcs[i].replace(" ",""))

print(sum(calcs))

Solution (Python):
S = list(map(int, input()))

n = len(S)
ans = []
def f(ind, cnt, keta):
	if ind == 0:
		ans.append(cnt)
		return

	f(ind-1, cnt+S[ind-1], 0)
	f(ind-1, cnt+S[ind-1]*(10**(keta+1)), keta+1)


f(len(S)-1, S[-1], 0)

print(sum(ans))

Solution (Python):

"""
Created on Tue Aug 20 17:21:41 2019

@author: Owner
"""

from collections import deque

S = input()

lens = len(S)
    
def rec(i, cp, s, tot):
    if i == lens:
        
        tmp = list(map(int, s.split("+")))
        return sum(tmp)
    
    tot += rec(i+1, cp+1, s[:i+cp]+"+"+s[i+cp:], tot) + rec(i+1, cp, s, tot)
    return tot
    

def main():    
    return print(rec(1, 0, S, 0))
             
                
                
            
            
                

    
if __name__ == '__main__':
    main()

Solution (Python):
import itertools
s = str(input())

s4  = []
for l in range(2 ** (len(s)-1)):
    s3 = list(s)
    h = 0
    for i in range(len(s)-1):
        if (l >> i) & 1:
            s3.insert(i+h+1,'+')
            h += 1
    s4.append(s3)
print(sum([eval(''.join(i)) for i in s4]))

Solution (Python):
import itertools
s = str(input())

lst = [i for i in itertools.product([0,1],repeat = len(s) - 1)]
s4  = []
for l in lst:
    s3 = list(s)
    h = 0
    for i in range(0, len(s)-1):
        if l[i] == 1:
            s3.insert(i+h+1,'+')
            h += 1
    s4.append(s3)
print(sum([eval(''.join(i)) for i in s4]))

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

Solution (Python):
S = input()
num = len(S) - 1
sum = 0

for i in range(2**num):
  k = 0
  for j in range(num):
    if ((i >> j) & 1):
      sum += int(S[k:j+1])
      k = j + 1
  sum += int(S[k:])

print(sum)

Solution (Python):
S = input()
num = len(S) - 1
sum = 0

for i in range(2**num):
  op = [''] * (num+1)
  formula = ''
  for j in range(num):
    if ((i >> j) & 1):
      op[j] = '+'
  for a,b in zip(S,op):
    formula += a + b
  sum += eval(formula)

print(sum)

Solution (Python):
s=tuple(input())
a=0
n=len(s)-1

for i in range(2**n):
    l=list(s)
    c=1
    for j in range(n):
        if (i>>j)&1:
            l.insert(j+c,"+")
            c+=1
    a+=eval("".join(l))
print(a)

Solution (Python):
s = list(input())
s.reverse()
n = len(s)
l = []
for i in range(n):
    s[i] = int(s[i])
for i in range(1,n):
    l.append(i)
bit = []
for i in range(2**(n-1)):
    b = []
    for j in range(n-1):
        if ((i >> j)& 1):
            b.append(l[j])
    bit.append(b)
ans = 0
for i in range(2**(n-1)):
    count = 0
    x = 0
    for j in bit[i]:
        c = 1
        while x < j:
            count += s[x]*c
            x += 1
            c = c * 10
    c = 1
    while x < n:
        count += s[x]*c
        x += 1
        c = c * 10
    
    ans += count
print(ans)

Solution (Python):
import itertools

user_input = input()
S = list(user_input)
N = int(user_input)
l = len(S)
bit_max = l-1

A = ["","+"]

if l == 1:
    print(N)

else:
    bit_max = l-1
    A = ["","+"]
    ans = 0

    for i in itertools.product(A,repeat=bit_max): 
        tmp = []
        for j,v in enumerate(S):
            tmp.append(v)
            if i[j] == "+":
                tmp.append("+")
            if j == bit_max -1:
                tmp.append(S[j+1])
                break
        
        values = "".join(tmp)
        values2 = values.split("+")

        tmp3 = 0
        for k in values2:
            tmp3 += int(k)
        
        ans += tmp3

    print(ans)

Solution (Python):
import sys
from pprint import pprint
from collections import deque

s = sys.stdin.readline().strip()

n = len(s)
q = deque()
q.append([])
for _ in range(n-1):
    q_tmp = deque()
    while q:
        tmp = q.popleft()
        
        for i in [0, 1]:
            tmp2 = tmp[:]
            tmp2.append(i)
            q_tmp.append(tmp2)
    q = q_tmp


ans = 0
while q:
    code = q.popleft()
    tmp_str = s[0]
    for i, s_i in enumerate(s):
        if i == 0:
            continue
        tmp_str += "" if code[i-1] == 0 else "+"
        tmp_str += s_i
    
    ans += sum(map(int, tmp_str.split("+")))

print(ans)

Solution (Python):
s = input()
n = len(s) - 1
bit = 0
total = 0
while bit < (1 << n):
    siki = s[0]
    for i in range(n):
        if bit & 1 << i:
            siki += '+'
        siki += s[i + 1]
    total += eval(siki)
    bit += 1
print(total)

Solution (Python):
a = list(input())
ans = 0
for i in range(1<<(len(a)-1)):
  s = a[0]
  for j in range(len(a)-1):
    if (i >> j) & 1:
      s += "+"
    s += a[j+1]
  ans += eval(s)

print(ans)

Solution (Python):

from itertools import product


def main():
    S = input()
    ans = 0
    for ops in tuple(product(("", "+"), repeat=len(S) - 1)):
        ops = ops + ("",)  
        exp = "".join(i + j for i, j in zip(S, ops))  
        ans += eval(exp)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
s = list(map(str, input()))
n = len(s)
ans = 0
for i in range(2**(n-1)):
  bag = []
  t = s[:]
  for j in range(n):
    if (i>>j) & 1:
      bag += [j]

  for num in bag[::-1]:
    t.insert(num+1, '+')
  ans += eval(''.join(t))
print(ans)

Solution (Python):
s = input()

def bit():
    if len(s) == 1:
        print(s)
    else:
        total = 0
        for i in range((2 ** (len(s) - 1))):
            bit = format(i, '0{}b'.format(len(s) - 1))
            e = ''
            for j in range(len(s) - 1):
                e += s[j]
                if bit[j] == '1':
                    e += '+'
            e += s[-1]
            total += eval(e)
        print(total)

def recursive():
    def _recurs(s):
        if len(s) == 1:
            return [s]
        with_plus = []
        without_plus = []
        for i in _recurs(s[1:]):
            with_plus.append('{}+{}'.format(s[0], i))
            without_plus.append('{}{}'.format(s[0], i))
        return with_plus + without_plus
    ans = _recurs(s)
    print(sum(eval(a) for a in ans))

answer = recursive
answer()

Solution (Python):
s = input()

if len(s) == 1:
    print(s)
else:
    total = 0
    for i in range((2 ** (len(s) - 1))):
        bit = format(i, '0{}b'.format(len(s) - 1))
        e = ''
        for j in range(len(s) - 1):
            e += s[j]
            if bit[j] == '1':
                e += '+'
        e += s[-1]
        total += eval(e)
    print(total)

Solution (Python):
def calc(S, n):
    if n == 0:
        return sum(map(int, S.split("+")))
    return calc(S[0:n]+"+"+S[n:], n-1) + calc(S, n-1)

S = input()
print(calc(S, len(S)-1))

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

ans=0
for i in range(2**(n-1)):
    f=[]
    s_=0
    for j in range(n-1):
        if (i>>j) & 1:
            t=s[s_:j+1]
            if len(t)!=0:
                f.append("".join(t))

            s_=j+1

    t=s[s_:]
    if len(t)!=0:
        f.append("".join(t))

    ans+=eval("+".join(f))

print(ans)

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

ans=0
for i in range(2**(n-1)):
    f=[]
    s_=0
    for j in range(n-1):
        if (i>>j) & 1:
            t=s[s_:j+1]
            if len(t)!=0:
                f.append("".join(t))

            s_=j+1

    t=s[s_:]
    if len(t)!=0:
        f.append("".join(t))

    ans+=eval("+".join(f))

print(ans)

Solution (Python):


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


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

    sub_sum = 0
    tmp_str = [s[0]]
    for j in range(n-1):
        
        if (i >> j) & 1:
            sub_sum += int("".join(tmp_str))
            tmp_str = [s[j+1]]
            
        
        else:
            tmp_str.append(s[j+1])
            
    sub_sum += int("".join(tmp_str))
    
    total_sum += sub_sum

print(total_sum)

Solution (Python):
S = input()

def fact(n):
    if n == 0:
        return 1
    return n * fact (n-1)
def comb(n,r):
    return fact(n) // (fact(r) * fact(n-r))
def calc(s,n):
    if n == 0:
        return int(s)
    ans = 0
    for i in range(len(s)-n):
        ln = len(s[i+1:])
        ans += int(s[:i+1])*comb(ln-1, n-1)+calc(s[i+1:],n-1)
    return ans
ans = 0
for i in range(len(S)):
    ans += calc(S, i)
print(ans)

Solution (Python):
s = input()
n = len(s)
ans = 0
for bit in range(1 << n-1):
    t = ""
    for i in range(n-1):
        if bit & (1<<i):
            t += "+"
        t += s[i+1]
    t = s[0] + t

    ans += sum(map(int,t.split("+")))
print(ans)

Solution (Python):
s = input()
n = len(s)
ans = 0
for bit in range(1 << n-1):
    string = ""
    for i in range(n-1):
        if bit & (1 << i):
            string += "+"

        string += s[i+1]
    string = s[0] + string
    ans += sum(list(map(int, string.split("+"))))
print(ans)

Solution (Python):
l_s = input()
sum = 0
for i in range(2**(len(l_s)-1)):
    m_s = list(l_s)
    countj = 0
    for j in range(len(l_s)-1):
        if ((i >> j) & 1):
            m_s.insert(j+1+countj,'+')
            countj += 1
    m_s = ''.join(m_s)
    sum += eval(m_s)
print(sum)

Solution (Python):






s = input()
sList = list(s)
sList = [int(i) for i in s]
sCount = len(sList)


aaa = 0

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

    binaryNumber = format(i,'b')
    binaryNumber = binaryNumber.zfill(sCount-1)
    binaryNumber = list(binaryNumber)
    binaryNumber = [int(i) for i in binaryNumber]
    
    
    for i in range(sCount-1):
        if binaryNumber[i] == 1 :
            binaryNumber[i] = '+'
    
    
    
    
    result = [None]*(len(sList)+len(binaryNumber))
    result[::2] = sList
    result[1::2] = binaryNumber
    
    while 0 in result:
        result.remove(0)
    
    
    result = map(str, result)
    resultStr = ''.join(result)
    
    aaa = aaa + eval(resultStr)
    
print(aaa)

Solution (Python):
import itertools
s = list(input())
op = ["+", ""]
tt = 0
for i in itertools.product(op, repeat=len(s)-1):
    t = 0
    ts = ""
    for j, v in enumerate(s):
        ts += v
        if j < len(i) and i[j] != "":
            t += int(ts)
            ts = ""
    t += int(ts)
    tt += t
print(tt)

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

for bit in range(1 << n - 1):
    f = s[0]

    for i in range(n - 1):
        if bit & (1 << i):
            f += "+"
        f += s[i + 1]

    ans += sum(map(int, f.split("+")))

print(ans)

Solution (Python):
s = list(map(str, input()))

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)


ans = 0

for i in range(2**(len(s)-1)):
	if i == 0:
		ans += int("".join(s))
		continue

	b = Base_10_to_n(i,2).rjust(len(s)-1, "0")
	ind = [j for j in range(len(b)) if b[j] == "1"]

	temp = []

	if len(ind) == 1:
		temp.append("".join(s[:ind[0]+1]))
		temp.append("".join(s[ind[0]+1:]))
		ans += sum(list(map(int, temp)))
		continue

	if len(ind) >= 2:
		for k in range(len(ind)):
			if k == 0:
				temp.append("".join(s[:ind[k]+1]))
			if 0 < k <= len(ind)-1:
				temp.append("".join(s[ind[k-1]+1:ind[k]+1]))
			if k == len(ind)-1:
				temp.append("".join(s[ind[k]+1:]))

		ans += sum(list(map(int, temp)))
		continue

print(ans)

Solution (Python):
l_s = input()
sum = 0
for i in range(2**(len(l_s)-1)):
    m_s = list(l_s)
    countj = 0
    for j in range(len(l_s)-1):
        if  i & (1<<j):
            m_s.insert(j+1+countj,'+')
            countj += 1
    m_s = ''.join(m_s)
    sum += eval(m_s)
print(sum)

Solution (Python):
def calc(S):
  out = int(S)
  for i in range(1, len(S)):
    out += (2**(len(S[i:]) - 1)) * int(S[:i]) + calc(S[i:])
  return out

S = input()
print(calc(S))

Solution (Python):
S = input()
n = len(S)-1
total_num = 0
if n == 0:
    total_num = S[0]
else:
    for i in range(2**n):
        num = '' 
        for j in range(n):
            if i & 2**j:
                num += S[j]
                total_num += int(num)
                num = ''
            else:
                num += S[j]
        num += S[-1]
        total_num += int(num)
print(total_num)

Solution (Python):
import itertools
S=input()
max_plus_number=len(S)-1

def convert_sum(l):
    sums=0
    start=0
    for i in l:
        sums+=int(S[start:i+1])
        start=i+1
    return sums+int(S[i+1:])

total_1=int(S)
for i in range(1,max_plus_number+1):
    places=list(itertools.combinations(range(len(S)-1),i))
    total_2=0
    for p in places:
        total_2+=convert_sum(list(p)) 
    total_1+=total_2

print(total_1)

Solution (Python):
S = input()
S_len = len(S) - 1
p = []
for i in range(2 ** S_len):
    tmp = bin(i)[2::]
    while len(tmp) < S_len:
        tmp = "0" + tmp
    p.append(str(tmp))

sum = 0
for i in p:
    if len(p) == 1:
        sum = S
        break
    P = list(i)
    tmp = int(S[0])
    cnt = 1
    for j in P:
        if j == "0":
            tmp *= 10
            tmp += int(S[cnt])
        else:
            sum += tmp
            tmp = int(S[cnt])
        cnt += 1
    sum += tmp
print(sum)

Solution (Python):

s = input()
ans = 0

for i in range(2**(len(s)-1)):
    a = ""
    for j in range(len(s)):
        a += s[j]
        if i & (1 << j):
            a += "+"
    ans += eval(a)
    
print(ans)

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

S_size = len(S)


def calc(s, plist):
    nlist = [0]*S_size
    nlistcount = 0
    start = 0
    end = 1
    plist = list(map(int, list(plist)))

    if plist == []:
        nlist[0] = int(s)

    for i in range(S_size-1):
        if plist[i] == 1:
            nlist[nlistcount] = int(S[start:end])
            start = end
            end += 1
            nlistcount += 1
        else:
            end += 1
        if end == S_size:
            nlist[nlistcount] = int(S[start:end])
            nlistcount += 1
    return sum(nlist)





def dfs(pi, plist):
    
    if pi == S_size - 1:
        
        return calc(S, plist)
    return dfs(pi + 1, plist+"0") + dfs(pi + 1, plist+"1")


print(dfs(0,""))

Solution (Python):
s = input()
length = len(s)
ans = 0
for i in range(1 << (length - 1)):
        front = 0
        for j in range(length):
                if 1 << j & i:
                        ans += int(s[front:j + 1])
                        front = j + 1
        ans += int(s[front:length])
print(ans)

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

Solution (Python):
S = input()

def dfs(start, S, curSum, res):
	if start >= len(S):
		res[0] += curSum
		return

    
	for i in range(start+1, len(S) + 1):
		dfs(i, S, curSum+int(S[start:i]), res)

	
res = [0]

dfs(0, S, 0, res)
print(res[0])

Solution (Python):
from functools import reduce
S = input()

def dfs(res, depth, path, S):
    if len(''.join(path)) == len(S):
        res.append(path)
    for i in range(depth + 1, len(S) + 1):
        dfs(res, i, path + [S[depth:i]], S)

res = []

dfs(res, 0, [], S)

print(sum(int(num) for nums in res for num in nums))

Solution (Python):
s = list(input())
def many_formulas(index,string):
    if index >=len(s):
        return eval(string)
    return many_formulas(index+1, string + "+" + s[index]) + many_formulas(index+1, string+s[index])
print(many_formulas(1,s[0]))

Solution (Python):
S = input()
length = len(S)
ans = 0
 
for i in range(length):
    ans += sum([int(S[i]) * (10**k) * 2**(max(0, length-i-k-2) + i) for k in range(length - i)])
 
print(ans)

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

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

print(ans+int(S))

Solution (Python):
c=input()

import copy
pattern = []

def roop_cal(l,max_l,temp):
    if (l ==0):
        pattern.append(copy.copy(temp))
    else:
        for i in range(2):
            temp[max_l-l] = i
            roop_cal(l-1, max_l, temp)
            
l =len(c)-1
temp = [None for _ in range(l)]
roop_cal(l,l,temp)
sum_equation = 0
for i in range(len(pattern)):
    temp = []
    for j in range(len(c)):
        temp.append(c[j])
        if(j >=len(pattern[i])):
            sum_equation = sum_equation+int(''.join(map(str,temp)))
        else:
            if(pattern[i][j]==1):
                sum_equation = sum_equation+int(''.join(map(str,temp)))
                temp = []
                
print(sum_equation)

Solution (Python):
s = input()
ans = 0

def plus_in(num, i):
  if i < len(s):
    plus_in(num + s[i], i + 1)
    plus_in(num + "+" + s[i], i + 1)
  else:
    nums = map(int, num.split("+"))
    sum_nums = sum(nums)
    global ans
    ans += sum_nums


plus_in(s[0], 1)
print(ans)

Solution (Python):
s = input()
ans = 0

def plus_in(num, i):
  if i < len(s):
    plus_in(num + s[i], i + 1)
    plus_in(num + "+" + s[i], i + 1)
  else:
    nums = map(int, num.split("+"))
    sum_nums = sum(nums)
    global ans
    ans += sum_nums


plus_in(s[0], 1)
print(ans)

Solution (Python):
s = input()
ans = 0

def plus_in(num, i):
  if i < len(s):
    plus_in(num + s[i], i + 1)
    plus_in(num + "+" + s[i], i + 1)
  else:
    nums = map(int, num.split("+"))
    sum_nums = sum(nums)
    global ans
    ans += sum_nums


plus_in(s[0], 1)
print(ans)

Solution (Python):
M=input()
N=len(M)
S=[]
B=[]
for i in range(0,N):
    S.append(M[i])
    B.append(M[i])
T=2**(N-1)
A=0
if N!=1:
    for i in range(0,T):
        t=[]
        k=i
        for j in range(0,N-1):
            if k>=2**(N-2-j):
                t.append(1)
                k=k-2**(N-2-j)
            else:
                t.append(0)
        n=0
        for j in range(0,N):
            S[j]=B[j]
        for j in range(0,N-1):
            if j<N-2:
                if t[j]==1:
                    n=n+int(S[j])
                else:
                    S[j+1]=S[j]+S[j+1]
            else:
                if t[j]==1:
                    n=n+int(S[j])+int(S[j+1])
                else:
                    S[j+1]=S[j]+S[j+1]
                    n=n+int(S[j+1])
        A=A+n
else:
    A=int(M)
print(A)

Solution (Python):
S = input()
length = len(S)
ans = 0

for i in range(length):
    ans += sum([int(S[i]) * (10**k) * 2**(max(0, length-i-k-2) + i) for k in range(length - i)])

print(ans)

Solution (Python):
S = input()
length = len(S)
ans = 0

for i in range(length):
    ans += sum([int(S[i]) * (10**k) * 2**(max(0, length-i-k-2) + i) for k in range(length - i)])

print(ans)

Solution (Python):

s = input()
n = len(s)

ans = 0
for b in range(1 << (n - 1)):
    tmp = 0
    for i, x in enumerate(s):
        tmp = 10 * tmp + int(x)
        if b >> i & 1:
            ans += tmp
            tmp = 0
    ans += tmp
print(ans)

Solution (Python):
S = input()

from itertools import combinations

s = int(S)
for l in range(1, len(S)):
    for c in combinations(range(1, len(S)), l):
        c = sorted(c)
        n = [int(S[lower:upper]) for lower, upper in zip([0] + c, c + [len(S)])]
        s += sum(n)

print(s)

Solution (Python):
S = input()

ans = 0

for bit in range(1 << (len(S) - 1)):
    f = S[0]

    for i in range(len(S) - 1):
        if bit & (1 << i):
            f += "+"
        f += S[i + 1]

    ans += sum(map(int, f.split("+")))

print(ans)

Solution (Python):
from inspect import currentframe


def debug_print(s):
    
    return


def debug_key(*args):
    names = {id(v): k for k, v in currentframe().f_back.f_locals.items()}
    debug_print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))


def solve(S):
    N = len(S)
    ans = 0

    for i in range(2 ** (N - 1)):
        culculate = S[0]
        for j in range(N - 1):
            if i & (1 << j):
                culculate += "+" + S[j + 1]
            else:
                culculate += S[j + 1]
        ans += eval(culculate)
        debug_key(culculate)
    print(ans)


if __name__ == '__main__':

    S_input = input()

    solve(S_input)

Solution (Python):
N = str(input())

score = 0
for i in range(2**(len(N)-1)):
    Ni = '0' * (len(N)-len(format(i, 'b'))-1) + format(i, 'b') + '0'
    l = list()
    buff = str()
    for n, ni in zip(N, Ni):
        buff += n
        if ni == '1':
            l.append(int(buff))
            buff = str()

    l.append(int(buff))
    score += sum(l)

print(score)

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

ans = 0

for mask in range(2 ** (l-1)):
    f = s
    last_plus = 0
    for bit in range(l-1):
        if (mask >> bit) & 1:
            ans += int(s[last_plus: bit+1])
            last_plus = bit + 1

    ans += int(s[last_plus:])

print(ans)

Solution (Python):
s = str(input())

ans = 0
for i in range(2 ** (len(s)-1)):
    plus_l = []
    cal_l = []
    for j in range(len(s)):
        bit = 2 ** j
        if i & bit > 0:
            plus_l.append(j)
    if len(plus_l) == 0:
        cal_l = [int(s)]
    else:
        pre = 0
        for k in plus_l:
            cal_l.append(int(s[pre:k+1]))
            pre = k+1
        cal_l.append(int(s[pre:]))
    ans += sum(cal_l)

print(ans)

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

sum_ = 0
for i in range(2 ** len_):
    formula = ''
    for j, s in enumerate(S):
        formula += s
        if i & 2**j:
            formula += '+'
    sum_ += eval(formula)

print(sum_)

Solution (Python):
s = str(input())

ans = 0
for i in range(2 ** (len(s)-1)):
    plus_l = []
    cal_l = []
    for j in range(len(s)):
        bit = 2 ** j
        if i & bit > 0:
            plus_l.append(j)
    if len(plus_l) == 0:
        cal_l = [int(s)]
    else:
        pre = 0
        for k in plus_l:
            cal_l.append(int(s[pre:k+1]))
            pre = k+1
        cal_l.append(int(s[pre:]))
    ans += sum(cal_l)

print(ans)

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

def sum_list(S,stock):
    if len(S) == 2:
        return int(S[0]) + int(S[1]) + int(S[0]+S[1]) + stock * 2
    elif len(S) == 1:
        return int(S[0])
    else:
        return sum_list(S[1:],int(S[0])+stock) + sum_list([S[0]+S[1]]+S[2:],stock)
                                                 
print(sum_list(s,0))

Solution (Python):
L = list(raw_input())
total = 0
for bit in range(2**(len(L) - 1)):
    P = [""] * (len(L))
    for k in range(len(L) - 1):
        if bit & (1 << k):
            P[k] = ""
        else:
            P[k] = "+"
    calc = ""
    for i in range(len(L)):
        calc += L[i] + P[i]
    calc = eval(calc)
    total += calc
print(total)

Solution (Python):
string = input()
text = []
for s in string:
    text.append(s)
    text.append('')

count = 0

for i in range(2**(len(string)-1)):
    for j in range(len(string)-1):
        if (i >> j) & 1:
            text[2*j+1] = '+'
        else:
            text[2*j+1] = ''

    formula = ''.join(text)
    count += eval(formula)

print(count)

Solution (Python):
L = list(input())
ans = 0
for bit in range(1 << (len(L)-1)) :
    P = [""]*len(L)
    for k in range(len(L)-1) :
        if bit & (1 << k) :
            P[k] = "+"
    calc = ""
    for i in range(len(L)) :
        calc += L[i] + P[i]
    ans += eval(calc)
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):
from itertools import combinations
S = input()
zenbu = list(range(len(S)+1))
soto = (zenbu[0], zenbu[-1])
naka = zenbu[1:-1]
kumi = []
for i in range(len(naka)+1):
    comb = list(combinations(naka, i))
    for c in comb:
        kumi.append(sorted(c + soto))

total_list = []
for k in kumi:
    total_list.append(sum([int(S[k[i]:k[i+1]]) for i in range(len(k)-1)]))
print(sum(total_list))

Solution (Python):
s = input()

def dfs(p, n):
    if n == 0:
        return eval(p)
    else:
        return dfs(p[:n] + "+" + p[n:], n-1) + dfs(p, n-1)

print(dfs(s, len(s)-1))

Solution (Python):
S = input()
len_s = len(S)-1
count = 0
ss = []
for i in range(2**len_s):
  binary = format(i, 'b').zfill(len_s+2)[2:]
  tmp=[S[0]]
  for j in range(len(binary)):
    if binary[j] =='1':
      tmp.append(S[j+1])
    else:
      tmp[-1] = tmp[-1]+S[j+1]
  count += sum(int(i) for i in tmp)
print(count)

Solution (Python):
s = input()

def plus(p,n):
	if n==0:
		return eval(p)
	else:
		
		return plus(p[:n] + '+' + p[n:], n-1) + plus(p,n-1)
  
print(plus(s,len(s)-1))

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


def dfs(summary, array, i):
    if i == length:
        return 0
    elif i == length -  1:
        return sum([int(x) for x in array.split("+")])
    array_plus = array[:-(length-i-1)] + "+" + array[-(length-i-1):]
    summary = 0
    summary += dfs(summary, array ,i+1)
    summary += dfs(summary, array_plus ,i+1)
    return summary



if length == 1:
    print(S)
else:
    print(dfs(0, S, 0))

Solution (Python):
S = input()


def sumall(ls = 0):
    bls = bin(ls)
    if len(S) <= len(bls)-2:
        return 0
    else:
        count = 0
        pi = 0
        for ib,b in enumerate(bls[::-1]):
            if b == 'b':
                count += int(S[pi:])
                break
            elif b == '1':
                count += int(S[pi:ib+1])
                pi = ib+1
        
        return count + sumall(ls+1)
if len(S) == 1:
    print(int(S))
else:
    print(sumall(0))

Solution (Python):
S = input()

ans = 0
for i in range(2 ** (len(S) - 1)):
    formula = ''
    flag = bin(i)[2:].zfill(len(S) - 1)
    for j, x in enumerate(flag):
        formula += S[j]
        if x == '1':
            formula += '+'
    if len(S) > 1:
        formula += S[-1]
    ans += eval(formula)

print(ans)

Solution (Python):
s = input()
len_s = len(s)
s = '+'.join(s)


ans = 0
for i in range(2**(len_s-1)):
    tmp_s = list(s)
    for j in range(len_s-1):
        if ((i>>j)&1):
            tmp_s[2*j+1] = ''
    tmp_s = ''.join(tmp_s)
    
    ans += eval(tmp_s)
    

print(ans)

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

import copy
cnt = 0
for i in range(2 ** (len(S)-1)):
    op = []
    for j in range((len(S)-1)):
        if ((i >> j) & 1):
            op.append(j)

    S_copy = copy.deepcopy(S)
    for idx, k in enumerate(op):
        S_copy.insert(k+1+idx, '+')
    cnt += eval(''.join(S_copy))

print(cnt)

Solution (Python):
s = input()
N = len(s)
ans = 0
temp = 0
for i in range(2**(N-1)):
	temp = [s[0]]
	for n in range(N-1):
		if (i >> n) & 1:
			ans += int("".join(temp))
			temp = [s[n+1]]
		else:
			temp.append(s[n+1])
	ans += int("".join(temp))
print(ans)

Solution (Python):
s = input()

def plus(p,n):
  if n==0:
    return eval(p)
  else:
    return plus(p[:n] + '+' + p[n:], n-1) + plus(p,n-1)
  
print(plus(s,len(s)-1))

Solution (Python):
s = input()


def insert_string(target_string, insert_point, ins_string):
    return target_string[:insert_point] + ins_string + target_string[insert_point:]


sum = 0

for i in range(2**(len(s)-1)):
    insert_count = 0
    temp_s = s
    for j in range(len(s)-1):
        if (i >> j) & 1: 
            temp_s = insert_string(temp_s, j+1+insert_count, '+')
            insert_count += 1

    sum += eval(temp_s)

print(sum)

Solution (Python):
S = str(input())
l = S.__len__()
ans = 0
for i in range(1 << (l-1)):
    p = []
    for j in range(l-1):
        if (i >> j) & 1 == 1:
            p.append(j)
    t = 0
    num = S[0]
    while(t < l-1):
        if t in p:
            ans += int(''.join(num))
            num = S[t+1]
        else:
            num += S[t+1]
        t += 1
    else:
        ans += int(''.join(num))

print(ans)

Solution (Python):
S = input()
ans = 0
N = len(S)
for i in range(2**(N-1)):
  b = bin(i)[2:]
  T = S
  while len(b)<N-1:
    b = '0'+b
  b = b[::-1]
  ind = [0]
  count= 1
  for j in range(N-1):
    if b[j]=='1':
      ind +=[count]
      count = 1
    else:
      count +=1
  ind = ind[1:]
  for h in ind:
    ans += int(T[:h])
    T = T[h:]
  ans += int(T)
  
print(ans)

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

ans = 0
for i in range(2 ** (len(s) - 1)):
    s_copy = s[:]
    for j in reversed(range(len(s))):
        if (i >> j) & 1:
            s_copy.insert(j + 1, '+')
    cut = ''.join(s_copy).split('+')

    for j in cut:
        ans += int(j)

print(ans)

Solution (Python):
s = input()

num = len(s) - 1

total = 0

for i in range(2 ** num):
    
    formula = s[0]
    for j in range(num):
        
        if (i >> j) & 1:
            formula += "+"
        formula += s[j + 1]
    
    total += eval(formula)
print(total)