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):
s = list(input())
size = len(s)
para = ["" for i in range(size-1)]
a = []
for i in range(size):
    if i == size-1:
        a.append(s[i])
    else:
        a.append(s[i])
        a.append(para[i])
ans = 0
for p in range(2**(size-1)):
    for j in range(size-1):
        if (p>>j) & 1 :
            a[2*j+1] = "+"
        else: 
            a[2*j+1] = ""
    ans += eval("".join(a))
print(ans)

Solution (Python):
num_lis = [int(x) for x in input()]
N = len(num_lis)
ans = 0
temp = 0

for b in range(1 << (N-1)):
    for c in range(N-1):
        if (b >> c) & 1:
            ans += temp + num_lis[c]
            temp = 0
        else:
            temp = (temp + num_lis[c]) * 10
    ans += temp + num_lis[-1]
    temp = 0

print(ans)

Solution (Python):
S  = list(input())
n = len(S)
ans = 0

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

    list = S[0]
    for j in range(1, n):

        if (i >> (j - 1)) & 1:

            list = list + "+" + S[j]
            

        else:
            list += S[j]

    ans += eval(list)

print(ans)

Solution (Python):
s = list(input())
N = len(s) - 1

ans = 0
for i in range(2 ** N):
    e = 0
    for j in range(N+1):
        ans += int(s[-(j+1)]) * (10 ** e)
        e += 1
        if ((i >> j) & 1):
            e = 0

print(ans)

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

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

print(ans)

Solution (Python):
s = input()

case = len(s)-1
allcase = 2 ** case
total = 0


for i in range(allcase):
    sum = s[0]
    
    for j in range(case):
        if ((i >> j) & 1):
            sum = sum + "+" + s[j+1]
        else:
            sum = sum + s[j+1]

    total =  total + eval(sum)
print(total)

Solution (Python):


s=input() 
n=len(s) 
total=0
for i in range(pow(2,(n-1))): 
    list=s[0]
    for j in range(1,n): 
        if (i>>(j-1))&1: 
            list=list+"+"+s[j]
        else:
            list+=s[j]
    total+=eval(list)
    

print(total)

Solution (Python):
S = input()

allSUM = 0


def dfs(i,strNum):
    


    if i == len(S)-1:
        tmp = strNum.split("+")

        for j in range(len(tmp)):
            tmp[j] = int(tmp[j])

        global allSUM
        allSUM += sum(tmp)

        return False

    if i+1 > len(S)-1:
        return False

    if(dfs(i+1,strNum+S[i+1])):
        return True

    if(dfs(i+1,strNum+"+"+S[i+1])):
        return True

    return False


dfs(0,S[0])

print(allSUM)

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

def getsum(t, total, sum_left=0):
  if len(t) == 1:
    total += sum_left + t[0]

  else:
    t0 = [t[0]*10 + t[1],] + t[2:]
    total = getsum(t0, total, sum_left)
    
    t1 = t[1:]
    sum_left += t[0]
    total = getsum(t1, total, sum_left)
  
  return total

print(getsum(s, 0))

Solution (Python):
S = input()
N = len(S)
nums = []
if N>2:
    for i in range(2**(N-1)):
        bi = bin(i)[2:].zfill(N-1)
        bi = '1' + bi + '1'
        l = 0
        for r in range(1,N+1):
            if bi[r] == '1':
                nums.append(int(S[l:r]))
                l = r
    res = sum(nums)
else:
    if N==1:
        res = int(S)
    else:
        res = int(S)+int(S[0]) + int(S[1])
print(res)

Solution (Python):
S = input()
N = len(S)
nums = []
if N>2:
    for i in range(2**(N-1)):
        bi = bin(i)[2:].zfill(N-1)
        bi = '1' + bi + '1'
        l = 0
        for r in range(1,N+1):
            if bi[r] == '1':
                nums.append(int(S[l:r]))
                l = r
    res = sum(nums)
else:
    if N==1:
        res = int(S)
    else:
        res = int(S)+int(S[0]) + int(S[1])
print(res)

Solution (Python):
s = [int(x) for x in input()]
n = len(s)
result = 0

for i in range(2**(n-1)):
  sum = 0
  tmp = s[0]
  for j in range(n-1):
    if (i >> j) % 2 == 1:
      sum += tmp
      tmp = s[j+1]
    else:
      tmp = tmp * 10 + s[j+1]
  sum += tmp
  result += sum

print(result)

Solution (Python):
n=list(input())
k=len(n)-1
x=0
for i in range(2**k):
    v=[""]*k
    for j in range(k):
        if ((i >> j) & 1):
            v[j]="+"
    ans=""
    for a,b in zip(n,v+[""]):
        ans+=(a+b)
    x+=eval(ans)
print(x)

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

total = 0
for i in range(2**(n-1)):
  tmp = s[0]
  for j in range(1, n):
    if (i >> j-1) & 1:
      tmp = tmp + "+" + s[j]
    else:
      tmp = tmp + s[j]
  
  total = total + eval(tmp)

print(total)

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

total = 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]
    else:
      tmp = tmp + s[j+1]
  
  total = total + eval(tmp)

print(total)

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

ans = 0
for i in range(1 << (len(S) - 1)):
    ss = S[0]
    for j in range(len(S) - 1):
        if ((i >> j) & 1) == 1:
            ss += "+"
            ss += S[j + 1]
        else:
        	ss += S[j + 1]

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

print(ans)

Solution (Python):
import sys

s = tuple(sys.stdin.readline().rstrip())

l = len(s)



def op(n):
  if n == "0":
    return ""
  else:
    return "+"


res = []
for i in range(2**(l-1)):
  
  ops = [op(x) for x in tuple(format(i*2, 'b').zfill(l))]
  
  
  

  eq = ''
  for num, j in zip(s, ops):
    eq = eq + num + j
  
  res.append(eval(eq))

print(sum(res))

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

print(ans)

Solution (Python):
from sys import stdin

S=input()
andbit = 2**10 -1
ans = 0
length = 2**(len(S) -1)
    
for i in range (length):
  bitup = andbit & i
  bitcheck = 1
  tmp=0
  for j in range(1,len(S),1):
    if bitup & bitcheck > 0:
      ans += int(S[tmp:j])
      tmp = j
    bitcheck = bitcheck << 1
  ans += int(S[tmp:len(S)])
print(ans)

Solution (Python):
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
inf = 10**9


def main():
    s = input()
    su = 0

    for i in range(2 ** (len(s) - 1)):
        a = []
        for j in range(len(s)):
            a.append(s[j])
            if (j < len(s)-1 and (i >> j) & 1):
                a.append("+")
        
        su += eval(''.join(a))

    print(su)


if __name__ == '__main__':
    main()

Solution (Python):

S = str(int(raw_input()))

def calc_ans(S):
  if len(S) == 1:
    return int(S), 1
  
  s_len = len(S)
  sum = count = 0
  for i in range(0, s_len):
    if i > 0:
      S_new = S[i:]
      t_sum, t_count = calc_ans(S_new)
      t_sum = (int(S[:i])* t_count) + t_sum
    else:
      t_sum = int(S)
      t_count = 1
    sum += t_sum
    count += t_count
  return sum, count

sum, count = calc_ans(S)

print(sum)

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

for n in range(2 ** (N - 1)):
    B = bin(n)[2:]
    while len(B) < N - 1:
        B = "0" + B
    idx = 0
    for i, b in enumerate(B):
        if b == "1":
            ans += int(S[idx:i+1])
            idx = i+1
        if i == len(B) - 1:
            ans += int(S[idx:N])

print(ans)

Solution (Python):
from itertools import product
s = input()
ans = 0
for op in product(["", "+"], repeat=len(s)-1):
    op = list(op)
    op.append("")
    ans += eval(''.join( a + b for a, b in zip(s, op)))
print(ans)

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

ans_lst = []
for i in range(2**n):
    op = ["+"] * n 
    for j in range(n):
        if ((i >> j) & 1):
            op[n-j-1] = ""
    formula = ""
    for num,opp in zip(s, op + [""]):
        formula += (num + opp)
    ans_lst = ans_lst + [eval(formula)]

print(sum(ans_lst))

Solution (Python):
from itertools import zip_longest

s = input()
n = len(s)-1

total = 0
li = [0] * 2**n

for i in range(2**n):
  op = [""] * n
  for j in range(n):
    if (i >> j) & 1:
      op[j] = "+"
  li[i] = op
  
for i in li:
  siki = ""
  for j, k in zip_longest(i, s, fillvalue=""):
    siki += k+j
  total += eval(siki)
  
print(total)

Solution (Python):

S = ""

def rec(nums,step,N): 

    if step == N:
        nums = list(map(int,nums))
        return sum(nums)

    else:
        num = S[step]
        nums2 = nums[::]
        nums2[-1] += num
        nums.append(num)
        return rec(nums,step+1,N) + rec(nums2,step+1,N)
        



def func():
    global S
    S = input()
    N =len(S)
    print(rec([S[0]],1,N))

if __name__ == '__main__':
    func()

Solution (Python):

S = list(input())
for i in range(len(S)):
    S[i] = int(S[i])

L = len(S)

sum_counter = 0
for i in range(L-1):
    for k in range(L-i-1):
        sum_counter += int(S[i] * (10**k) * (2**(L-i-2-k)) * (2**i))
        
    sum_counter += int(S[i] * (10 ** (L-(i+1)) * (2**i - 1)))




sum_counter += S[-1] * (2**(L-1)-1)




for i in range(L):
    sum_counter += S[i] * (10**(L-i-1))

print(sum_counter)

Solution (Python):
S = input()

sum_value = 0
for n in range(2 ** (len(S) - 1)):
	line = ""
	for i, s in enumerate(S):
		line += s
		if (i < (len(S) - 1)) and (n >> i & 1):
			line += "+"
	sum_value += eval(line)
	
print(sum_value)

Solution (Python):
S = list(input())
n = len(S)-1
ans = ''

for i in range(2 ** n):
    ope = [''] * n
    for j in range(n):
        if ((i >> j) & 1):
            ope[j] = '+'

    for x, y in zip(S, ope):
        ans += x+y
    ans += S[n] + '+'

print(eval(ans[:len(ans)-1]))

Solution (Python):
from itertools import product

S = input()
ans = 0
for lst in product(['', '+'], repeat=len(S)-1):
    formula = ''
    for s, p in zip(S[:-1], lst):
        formula += (s+p)
    formula += S[-1]
    ans += eval(formula)
print(ans)

Solution (Python):
def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    nums = list(map(lambda x: int(x), inputs[0]))
    opr_num = len(nums) - 1
    opr_pattern = 2 ** opr_num

    total = 0
    for opr_digit in range(opr_pattern):
        oprs = []
        tmp_opr_digit = opr_digit
        for _ in range(0, opr_num):
            
            if tmp_opr_digit & 1 == 1:
                oprs.append("+")
            else:
                oprs.append("")
            tmp_opr_digit = tmp_opr_digit >> 1
        oprs.reverse()

        formula = ""
        for i, v in enumerate(oprs):
            formula += str(nums[i]) + str(oprs[i])
        formula += str(nums[-1])
        total += eval(formula)

    return total


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

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

op_cnt = len(s)-1
sum = 0
for i in range(2**op_cnt):
    op = ['']*op_cnt
    for j in range(op_cnt):
        if (i>>j) & 1:
            op[j] = '+'

    fomula = s[0]
    for j in range(op_cnt):
        fomula += op[j]
        fomula += s[j+1]
    
    sum += eval(fomula)

print(sum)

Solution (Python):








S = [int(x) for x in list(input())]
max_bits = 2 ** (len(S) - 1)

l = []
for n in range(max_bits):
    tmp = S[0]
    s = 0
    for i in range(len(S) - 1):
        if n & (1 << (len(S) - 2 - i)):
            tmp = 10 * tmp + S[i + 1]
        else:
            s += tmp
            tmp = S[i + 1]
    s += tmp

    l.append(s)

print(sum(l))

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

print(ans)

Solution (Python):
s = input()


value = 0

def compute(state,s):
	x = 0
	start_pos = 0
	end_pos = 0
	for i in range(len(s)-1):
		if state[i] == '0':
			continue
		else:
			end_pos = i+1
			x += int(s[start_pos:end_pos])
			start_pos = i+1
	if s[end_pos:] != '':
		x += int(s[end_pos:])
	return x


for i in range(2**(len(s)-1)):
	state = format(i,'0%ib'%(len(s)-1))
	value += compute(state,s)
print(value)

Solution (Python):
s = input()

ans = 0
for i in range(2 ** (len(s) - 1)):
    fml = ''
    for j in range(len(s) - 1):
        fml += s[j]
        fml += '+' if '{:0>10b}'.format(i)[::-1][j] == '1' else ''
    fml += s[-1]
    ans += eval(fml)
    
print(ans)

Solution (Python):
import copy

def culc(array):
    summy = 0
    indexes = [i for i, x in enumerate(array) if x == '+']
    ff = 0
    for i in indexes:
        summy += int("".join(array[ff:i]))
        ff = i+1
    summy += int("".join(array[ff:]))
    return summy

nums = list(input())
ans = 0

for i in range(2**(len(nums)-1)):
    bit = bin(i)
    obj = copy.deepcopy(nums)
    k = 0
    for j in range(len(nums)-1):
        if ( i >> j) & 1:
            obj.insert(j+1+k,'+')
            k += 1
    ans += culc(obj)

print(ans)

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

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


ans = 0
for i in range(2 ** (l-1)):
    eq = s[0]
    for j in range(l-1):
        if i & (1<<j):
            eq += '+'+s[j+1]
        else:
            eq += s[j+1]
    tmp = list(map(int, eq.split('+')))
    ans += sum([int(chr) for chr in tmp])

print(ans)

Solution (Python):
import sys
import re

S=str(input())
ans=0
for i in range(1<<(len(S)-1)):
  start=0
  score=0
  for j in range(len(S)-1):
    if (i>>j)&1==0:
      score+=int(S[start:j+1])
      start=j+1
  score+=int(S[start:len(S)])
  ans+=score

print(ans)

Solution (Python):

"""
C - たくさんの数式 / Many Formulas
"""
import types



abcd = input()
n = len(abcd) - 1 
sum_ = 0


for i in range( 2**n ):
    op = n * ["+"]

    
    
    for j in range(n):
        if ( i >> j ) & 1:
            op[n-1 -j] = ""
            
    formula = ""
    for p_n, p_o in zip(abcd, op+[""]):
        formula += (p_n + p_o)
    

    sum_ += eval(formula)

print(sum_)

Solution (Python):
S=input()

ans=0
for i in range(1<<len(S)-1):
  S2=S
  for j in range(0,len(S)-1):
    if ((i>>j)&1)==1:
      S2=S2[:-(len(S)-j)+1]+'+'+S2[-(len(S)-j)+1:]
  ans+=sum(map(int,S2.split('+')))
print(ans)

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


op_cnt = len(S) - 1  

for i in range(2 ** op_cnt):
  T = ""
  for j in range(op_cnt):
    T += S[j]
    if ((i >> j) & 1):
      T += "+"
  T += S[op_cnt]
  c += eval(T)
print(c)

Solution (Python):
s=input()
sl=[]
ans=0
if len(s)==1:
  print(int(s))
else:
  for iii in range(2**(len(s)-1)):
    sind='{:0'+str(len(s)-1)+'b}'
    astr=sind.format(iii)
    astr=astr.replace("1","+")
    astr=astr.replace("0","x")
    lans=s[0]
    for jjj in range(len(astr)):
      lans+=astr[jjj]+s[jjj+1]
    lans=lans.replace("x","")
    ans+=int(eval(lans))
  print(ans)

Solution (Python):
s = input()

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

    ans += int(s[s_start:])
print(ans)

Solution (Python):
s = input()

max_plus = len(s) - 1

numList = [int(c) for c in s]

sMax = (1 << max_plus) - 1

ans = 0

for plus_pos in range(sMax + 1):
    sum = 0

    num = numList[0]

    for i in range(max_plus):
        if ((plus_pos >> i) & 1) == 1:
            sum += num
            num = numList[i + 1]
        else:
            num = num * 10 + numList[i + 1]

    sum += num
    ans += sum

print(ans)

Solution (Python):
n = input()
x = 0

a = len(n) - 1

for i in range(2 ** a):
    op = ['']*(a+1)
    for j in range(a):
        if ((i>>j) & 1):
            op[j] = '+'
    formula = ''
    for p,q in zip(n, op):
        formula += p + q
    x += eval(formula)
    
print(x)

Solution (Python):
from itertools import combinations

S = input()

pllst = [i for i in range(1, len(S))]
exp = []
for i in range(len(pllst)+1):
    exp.extend(list(combinations(pllst, i)))

ans = ''
for lst in exp:
    if len(lst) == 0:
        ans += S
    else:
        pivot = 0
        for order in lst:
            ans += '+' + S[pivot:order]
            pivot = order
        ans += '+' + S[pivot:]
print(eval(ans))

Solution (Python):
S = input()
SL = [i for i in S]
sublist = [-1]*(len(S)-1)
anslist = []
ans = []
for i in range(1<<len(S)-1):
    for j in range(len(S)-1):
        if ((i>>j)&1)==1:
            sublist[j] = "+"
    anslist.append(SL[0])
    for j in range(len(S)-1):
        if sublist[j] == "+":
            anslist.append(sublist[j])
            anslist.append(SL[j+1])
        else:
            anslist.append(SL[j+1])
    ans.append(eval("".join(anslist)))
    anslist = []
    sublist = [-1]*(len(S)-1)
print(sum(ans))

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

print(sum)

Solution (Python):
s = input()
sum = 0
for i in range(2**(len(s)-1)):
    term = 0
    for j in range(len(s)-1):
        term *= 10
        if (i//(2**j))%2 == 0:
            sum += term + int(s[j])
            term = 0
            if j == len(s)-2:
                sum += int(s[-1])
        else:
            term += int(s[j])
            if j == len(s)-2:
                sum += term*10 + int(s[-1])
if len(s) == 1:
    sum = int(s)

print(sum)

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

for i in range(2**(len(s)-1)):
    l = []
    for b in range(len(s)):
        bit = 2**b
        if i & bit > 0:
            l.append(b)
    if len(l) == 0:
        cal_l = [int(s)]
    else:
        pre = 0
        cal_l = []
        for index in l:
            cal_l.append(int(s[pre:index+1]))
            pre = index+1
        cal_l.append(int(s[pre:]))
    sum_ += sum(cal_l)
print(sum_)

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

if n == 1:
    print(S)
    exit()

for i in range(2**(n-1)):
    sum = 0
    start = 0
    for j in range(n-1):
        if ((i>>(n-j-2)) & 1):
            sum += int(S[start:j+1])
            start = j+1
    sum += int(S[start:])
    ans += sum
print(ans)

Solution (Python):
S = input()

ans = 0
num = len(S) - 1

for i in range(2**num):
    tmp_s = S
    for j in range(num):
        if((i >> j) & 1):
            tmp_s = tmp_s[:num-j] + "+" + tmp_s[num-j:]
    ans += sum(list(map(int, tmp_s.split("+"))))

print(ans)

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

for i in range(2**n):
    num = []
    bi = format(i, '0'+str(n)+'b')
    for j in range(n):
        num.append(s[j])
        if bi[j] == '1':
            num.append('+')
    num.append(s[-1])
    j_num = ''.join(num)
    ans += eval(j_num)

print(ans)

Solution (Python):
from itertools import product

s = input()

li = product(['', '+'], repeat=len(s))
st = set()
for c in li:
    ss = ''.join([a + b for (a, b) in zip(s,c)])
    if ss[-1] != '+':
        st.add(ss)
ans = 0
for sss in st:
    ans += eval(sss)

print(ans)

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

Solution (Python):
s = [w for w in input()]
length = len(s)
sum = 0

for i in range(2 ** (length-1)):
    start = 0
    b = format(i, 'b')[::-1]
    for end, flag in enumerate(b):
        if flag == '1':
            extract_s = ''.join(s[start: end + 1])
            sum += int(extract_s)
            start = end + 1
    if start != length:
        extract_s = ''.join(s[start:])
        sum += int(extract_s)

print(sum)

Solution (Python):
def bi(x, length):
    ret = "".join(["0" for _ in range(length)])
    return (ret + str(bin(x))[2:])[-length:]


def solve(inp):
    l = len(inp) - 1
    tot = 0
    for i in range(2**l):
        binary = bi(i, l)
        expression = "".join([inp[j] + "+" if binary[j] == "1" else inp[j] for j in range(l)] + [inp[-1]])

        tot += sum(int(e) for e in expression.split("+"))
    return tot

inp = input()
print(solve(inp))

Solution (Python):
def bi(x,n):
    o = [0]*n
    c = 0
    while x:
        o[c] = x%2
        x //= 2
        c += 1
    return o

S = input()
l = len(S)-1
ans = 0
for i in range(2**l):
    o = bi(i,l)
    j = ''.join([S[x]+['+',''][o[x]] for x in range(l)]+[S[-1]])
    for k in j.split('+'):
        ans += int(k)

print(ans)

Solution (Python):
s = input()
n = len(s)
sum = 0
for i in range(2**(n-1)):
  k = i
  a = 0
  b = 0
  for j in range(n):
    b += 1
    if(k%2==1):
      sum += int(s[a:b])
      a = b
    elif(k==0):
      sum += int(s[a:n])
      break;
    k = k//2
print(sum)

Solution (Python):
S = input()

symbol = ['+', '']

solve = []
for i in range(1 << len(S)-1):
  equation = [S[0]]
  for j in range(len(S)-1):
    equation.extend([symbol[(i >> j) & 1], S[j+1]])
  solve.append(eval(''.join(equation)))

ans = sum(solve)
print(ans)

Solution (Python):

num = input()
num_array = [i for i in num]

splits = len(num) - 1
n = 2 ** splits

sum = 0

if splits > 0:
    for i in range(n):
        bin = format(i, "0{}b".format(splits))
        bin_array = [i for i in bin]
        tmp_num = str(num_array[0])
        for index, value in enumerate(bin_array):
            if value == "0":
                tmp_num += num_array[index+1]
            else:
                sum += int(tmp_num)
                tmp_num = num_array[index+1]
        sum += int(tmp_num)
else:
    sum = num

print(sum)

Solution (Python):
def calc(ds):
    sum = 0
    cnt = 0
    if len(ds) == 0:
        return (0, 1)
    x = 0
    for i in range(len(ds)):
        x = 10*x + ds[i]
        (s, c) = calc(ds[i+1:])
        sum += s + c * x
        cnt += c
    return (sum, cnt)

def main():
    S = input().strip()
    ds = [int(c) for c in S]
    (answer, _) = calc(ds)
    print(answer)
    
main()

Solution (Python):
import sys


def input():
    return sys.stdin.readline()[:-1]


s = str(input())
ans = 0
for i in range(1 << len(s)-1):
    temp = ''
    for j in range(len(s)-1):
        if (i >> j) & 1:
            temp += s[j] + '+'
        else:
            temp += s[j]
    ans += eval(temp+s[-1])
print(ans)

Solution (Python):
s = input()
answer = 0
sumList = []
numStr = ""
if len(s) == 1:
  print(s)
else:
  for i in range(2**(len(s)-1)):
    bit = "0" + str(len(s) - 1) + "b"
    iStr = format(i, bit)
    numStr += s[0]
    for j in range(len(iStr)):
      if iStr[j] == "1":
        sumList.append(int(numStr))
        numStr = s[j+1]
      else:
        numStr += s[j+1]
    sumList.append(int(numStr))
    numStr = ""
    answer += sum(sumList)
    sumList = []
  print(answer)

Solution (Python):
S = input()

length = len(S) - 1
ans = 0

for i in range(2 ** length):
    bit = bin(i)[2:].zfill(length)
    T = ""
    for j in range(len(S)):
        if j == 0:
            T += S[j]
            continue
        else:
            b = bit[j-1]
            if b == "1":
                T += "+"
            T += S[j]
    ans += eval(T)
print(ans)

Solution (Python):
l=list(input())
keta=len(l)
i=0
S=[0]*keta
while i<keta:
    if i==0:
        S[i]=int(l[-1])
    else:
        a=10**i
        for j in range(i):
            a=a+(2**(i-1-j))*(10**j)
        S[i]=2*S[i-1]+int(l[-(i+1)])*a
    i=i+1
print(S[-1])

Solution (Python):
from itertools import combinations

S = str(input())
n = len(S)

ans = 0
for i in range(1 << (n-1)):
    cur_ans = int(S[0])
    for j in range(n-1):
        add_plus = (i >> (n-2-j)) & 1
        if add_plus:
            ans += cur_ans
            cur_ans = 0
        else:
            cur_ans *= 10
        cur_ans += int(S[j+1])
    ans += cur_ans
print(ans)

Solution (Python):
from itertools import combinations

S = str(input())
pos = [i for i in range(len(S)-1)]
insert_indices = [comb for i in range(len(S)) for comb in combinations(pos, i)]

ans = 0

for inds in insert_indices:
    cur_ix = 0
    cur_ans = 0
    while cur_ix < len(S):
        cur_ans += int(S[cur_ix])
        if cur_ix == len(S)-1:
            break
        if cur_ix in inds:
            ans += cur_ans
            cur_ans = 0
        else:
            cur_ans *= 10
        cur_ix += 1
    ans += cur_ans
    
print(ans)

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

for i in range(2 ** (le-1)):
    l = [""] * (le-1)
    for j in range(le):
        if i >> j & 1:
            l[j] = "+"
    
    f = ""
    for j, k in zip(n, l + [""]):
        f += (j + k)
        
    s += eval(f)

print(s)

Solution (Python):
from itertools import product
import bisect
import sys


def input():
    return sys.stdin.readline()[:-1]









S = input()
ans = 0
for p in product(range(2), repeat=len(S)-1):
    tmp = ''
    for i in range(len(S)-1):
        if p[i] == 1:
            tmp += S[i]+'+'
        else:
            tmp += S[i]
    ans += eval(tmp+S[-1])
print(ans)

Solution (Python):
from itertools import product
S=input()
ans=0
for p in product(range(2),repeat=len(S)-1):
    tmp=''
    for i in range(len(S)-1):
        if p[i]==1:
            tmp+=S[i]+'+'
        else:
            tmp+=S[i]
    ans+=eval(tmp+S[-1])
print(ans)

Solution (Python):
s = list(map(int, list(input())))
n=len(s)
ans=0

for i in range(n):
	for j in range(n-i-1):
		ans += (2**i) * (2**(n-i-j-2) * (10**j) * s[i])
	ans += (2**i)*(10**(n-i-1))*s[i]
print(ans)

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

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

print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = list(input())

l = len(S)

anss = []
for i in range(1<<l-1):
	ans = []
	i = list("{:b}".format(i).zfill(l-1))
	
	S_ = S.copy()
	ans.append(S_.pop(0))
	while S_ != []:
		if i.pop(0) == '1':
			ans.append("+")
		ans.append(S_.pop(0))
	anss.append(eval("".join(ans)))
print(sum(anss))

Solution (Python):
import itertools
N=input()
ans=0
l=itertools.product(range(2),repeat=len(N)-1)
for i in l:
	tmp=''
	for j in range(len(i)):
		if i[j]==0:
			tmp+=N[j]
		else:
			tmp+=N[j]+'+'
	tmp+=N[-1]
	ans+=eval(tmp)
print(ans)

Solution (Python):
from itertools import product
s = input()
ans = 0
for p in product(range(2),repeat=len(s)-1):
    tmp = ''
    for i in range(len(s)-1):
        if p[i] == 1:
            tmp += s[i]+'+'
        else:
            tmp += s[i]
    ans += eval(tmp+s[-1])
print(ans)

Solution (Python):
import itertools
def make_list(length, i):
    seq = []
    for j in range(length-1):
        seq.append(j)
    return list(itertools.combinations(seq, i))
if __name__ == '__main__':
    s = input()
    lst = []
    ans = 0
    for i in range(len(list(s))):
        lst += make_list(len(list(s)), i)
    expr = ''
    for l in lst:
        if len(l) == 0:
            expr = s
        else:
            before = 0
            expr = ''
            for i in range(len(l)):
                if before == l[i]:
                    expr += s[before] + '+'
                else:
                    expr += s[before:l[i]+1] + '+'
                before = l[i] + 1
                if i == len(l) - 1:
                    expr += s[before:]
        ans += eval(expr)
    print(ans)

Solution (Python):
S=input()
ans=0
if len(S)-1==0:
    print(int(S))
    quit()
for i in range(2**(len(S)-1)):
    k=bin(i)[2:].zfill(len(S)-1)
    l=int(S[0])
    for j in range(len(k)):
        t=int(k[j])
        if t==1:
            ans+=l
            l=int(S[j+1])
        else:
            l=l*10+int(S[j+1])
    ans+=l
print(ans)

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

def f(shiki, index):
	global ans
	l = len(shiki)
	if index < l - 1:
		f(shiki, index + 1)
		f(shiki[: index + 1] + '+' + shiki[index + 1:], index + 2)
		
	else:
		ans += sum(list(map(lambda x: int(x), shiki.split('+'))))

f(S, 0)
print(ans)

Solution (Python):
s=input()
ls=len(s)-1
ans=0
for i in range(2**ls):
    mask=str(bin(i))[2:]
    mask=mask.zfill(ls)
    a=""
    for j in range(ls):
        a+=s[j]
        if mask[j]=='1':
            a+="+"
    a+=s[-1]
    ans+=eval(a)
print(ans)

Solution (Python):
import itertools
s=input()
ans=0
n=len(s)
l=[i for i in range(1,n)]
for i in range(1,n):
    for x in list(itertools.combinations(l, i))[::-1]:
        ss=list(s)
        for xx in x[::-1]:
            ss.insert(xx,'+')
        ans+=eval(''.join(ss))

ans+=int(''.join(s))
print(ans)

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

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

ans = 0
for i in range(1 << N):
    t = []
    
    for j in range(N):
        if (i >> j) & 1:
            t.append(j)

    if len(t) == 0:
        ans += int("".join(map(str, S)))
    else:
        a = S[0]
        for i in range(N):
            if i in t:
                a += "+{}".format(S[i + 1])
            else:
                a += str(S[i + 1])
                
        ans += eval(a)

print(ans)

Solution (Python):
S = list(map(str, input()))
S_tmp = []
sum_all = 0
sum_tmp = []

for i in range(len(S)*2-1):
    if i % 2 == 0:
        S_tmp.append(S[int(i/2)])
    
    else:
        S_tmp.append(" ")

def bubunwa1(i, S_tmp, sum_all):
    if i < len(S)-1:
        S_tmp[2*i + 1] = '+'
        bubunwa1(i+1, S_tmp, sum_all)

        S_tmp[2*i + 1] = ''
        bubunwa1(i+1, S_tmp, sum_all)

    elif i == len(S)-1:
        sum_all = eval(''.join(S_tmp).replace(' ', ''))
        sum_tmp.append(sum_all)

bubunwa1(0, S_tmp, sum_all)
print(sum(sum_tmp))

Solution (Python):
S = input()
n = len(S)
s = [int(S[i]) for i in range(n)]
def solve(i, su, re):
    if i == n - 1:
        return(su + re * 10 + s[i])
    else:
        return(solve(i + 1, su + re * 10 + s[i], 0) + solve(i + 1, su, re * 10 + s[i]))
print(solve(0,0,0))

Solution (Python):
import itertools
S=list(input())
l=['','+']
L=list(itertools.product(l,repeat=len(S)-1))
ans=0
for i in range(2**(len(S)-1)):
    a = S[0]
    for j in range(len(S)-1):
        a+=L[i][j]+S[j+1]
    ans+=eval(a)
print(ans)

Solution (Python):
import itertools
S = input()
op = ['+','']
length = len(S) -1
ans = 0

for o in itertools.product(op, repeat=length):
	exp = ""
	for i in range(length):
		exp += S[i]+o[i]
	exp += S[length]
	ans += eval(exp)

print(ans)