Harryxun/stf_run huggingface dataset:
from decimal import Decimal, ROUND_HALF_UP
n,k = map(int,input().split())
ans = 0
if k % 2 ==0:
    k = Decimal(n/k).quantize(Decimal('0'),rounding=ROUND_HALF_UP)
    ans = k**3 +(n//k)**3
else:
    ans = (n // k)**3
print(ans)

### FIXED CODE ###

n,k = map(int,input().split())
ans1 = 0
ans2 = 0
ans = 0
for x in range(1,n+1):
    if x % k ==0:
        ans1 +=1
if k % 2 == 0:
    for y in range(1,n+1):
        if y % k == k/2:
            ans2 +=1
print(ans1**3+ans2**3)
import counter

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    max_ans = 0
    for i in range(num):
        start = s[i]
        c = s.collections.Counter(1)
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
    print(max_ans) 

### FIXED CODE ###

import collections

num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
    print(1)
else:
    c = collections.Counter(s)
    max_ans = 0
    for i in range(num):
        start = s[i]
        current_ans = c[start]+c[start+1]+c[start+2]
        max_ans = max(current_ans,max_ans)
        i += c[start]
    print(max_ans)
import fractions
from functools import reduce
def func():
    n,x0 = map(int,input().split())
    x = [int(i) for i in input().split()]
    x.append(x0)
    x.sort()
    x.reverse()
    
    l = []
    before = 0
    before = None
    for xi in x:
        if before == None:
            before = xi
            continue
        l.append(xi-before)
        before = xi
    
    print(abs(reduce(fractions.gcd,l)))
func()

### FIXED CODE ###

def func():
    a,b = map(int,input().split())
    if a & 1 == 1 and b & 1 == 1:
        print("Yes")
    else:
        print("No")
func()
from collections import Counter
import fractions

N = int(input())
s=[0]*N
S = []
mydict = {}
flag=0
for i in range(N):
    s_sorted =''.join(map(str, sorted(str(input()))))
    S.append(s_sorted)
c = Counter(S)
dic = {k: v for k, v in c.items() if v !=1}
if dic == {}:
    print(0)
else:
    ans =0
    for i in range(len(list(c.values()))):
        ans = ans+math.factorial(list(dic.values())[i])/math.factorial(2)/math.factorial(list(dic.values())[i]-2)
    print(int(ans))

### FIXED CODE ###

n = int(input())
strings_list = [list(input()) for i in range(n)]
counter = 0
dict = {}
 
for strings in strings_list:
    strings = "".join(sorted(strings))
    if strings in dict.keys():
        counter += dict[strings]
        dict[strings] += 1
    else:
        dict[strings] = 1
print(counter)
N = int(input())
a = [int(input()) for i in range(N)]

total = int(max(a)/2)
print(max(a))
print(total)
a.remove(max(a))
print(a)
total += sum(a)

### FIXED CODE ###

D=input()
 
if D=='25':
    print('Christmas')
elif D=='24':
    print('Christmas Eve')
elif D=='23':
    print('Christmas Eve Eve')
elif D=='22':
    print('Christmas Eve Eve Eve')
N,M = map(int,input().split())

sclist = []
for count in range(M):
    d = list(map(int,input().split()))
    sclist.append(d)

flag = False;
for count in range(10**(N-1),10**(N)):
    flag = False
    for count1 in range(M):
        s = sclist[count1][0]
        c = sclist[count1][1]
        if str(count)[s-1] == str(c):
            flag = True
        else:
            flag = False
            break
    if flag == True:
        print(count)
        break

if flag == False and M != 0:
    print(-1)
elif flag == False and M == 0:
    print(10**(N-1))




### FIXED CODE ###

N= int(input())

count = 0

if N % 2 == 0:
    print(int(N/2))
else:
    print(int(N/2) + 1)
a = int(input())
        
result =0
for i in range(1,a+1):
  if len(str(i)) % 2 == 1:
      result = result + 1

print(result)

### FIXED CODE ###

A, B, C = input().split()

a = int(A)
b = int(B)
c = int(C)
if b + c <= a:
  result = 0
else:
  result = b+c-a
 
print(result)
import numpy as np
N=list(map(int,input().split()))
A,B=max(N),min(N)
#ユーグリッド
GCD=1
while True:
    r=A%B
    if r==0:
        GCD=B
        break
    else:
        A=B
        B=r

num_list=np.arange(1,GCD+1)
count=0
while not list(num_list) == [] :
    num=num_list[0]
    if A%num==0 and B%num==0:
        count+=1
        if num==1:
            num_list=num_list[~(num_list==1)]
        else:
            num_list=num_list[~(num_list % num == 0)]
    else:
        num_list=num_list[~(num_list % num == 0)]
print(count)

### FIXED CODE ###

import numpy as np
N=list(map(int,input().split()))
A,B=max(N),min(N)
#ユーグリッド
GCD=1
while True:
    r=A%B
    if r==0:
        GCD=B
        break
    else:
        A=B
        B=r

if GCD==1:
    print(1)
else:
    def factorization(n):
        arr = []
        temp = n
        for i in range(2, int(-(-n**0.5//1))+1):
            if temp%i==0:
                cnt=0
                while temp%i==0:
                    cnt+=1
                    temp //= i
                arr.append([i, cnt])

        if temp!=1:
            arr.append([temp, 1])

        if arr==[]:
            arr.append([n, 1])

        return arr

    _GCD=factorization(GCD)
    num_list=[1]
    for num in _GCD:
        num_list+=[num[0]]
    #これで素因数分解の加工が完全に完了
    print(len(num_list))
def BellmanFord(edges,num_v,source):
  #グラフの初期化
  inf=float("inf")
  dist=[inf for i in range(num_v)]
  dist[source-1]=0

  #辺の緩和
  for i in range(num_v):
    for edge in edges:
      if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:
        dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
        if i==num_v-1 and edge[1]==num_v : return -1
  return dist

N,M,P = [int(x) for x in input().split()]
gp = []
for _ in range(M):
    A,B,C = [int(x) for x in input().split()]
    gp.append([A,B,P-C])

li = BellmanFord(gp,M,1)
if(li==-1):
    print(-1)
else:
    print(max(0,-li[N-1]))


### FIXED CODE ###

def BellmanFord(edges,num_v,source):
    #グラフの初期化
    inf=float("inf")
    dist=[inf for i in range(num_v)]
    dist[source-1]=0
    flag = False

    #辺の緩和
    for i in range(num_v):
        for edge in edges:
          if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:
            dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
            if i==num_v-1:
                if edge[1] == num_v:
                    return -1
                else:
                    dist[edge[1]-1] = -inf
                    flag = True
    if flag:
        for i in range(num_v):
            for edge in edges:
                if dist[edge[1]-1]>dist[edge[0]-1] + edge[2]:
                    dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
                    if edge[1] == num_v :
                        return -1

    return dist

N,M,P = [int(x) for x in input().split()]
gp = []
for _ in range(M):
    A,B,C = [int(x) for x in input().split()]
    gp.append([A,B,P-C])

li = BellmanFord(gp,N,1)
if(li==-1):
    print(-1)
else:
    print(max(0,-li[N-1]))
import numpy as np
from collections import deque

@np.vectorize
def trans(s):
    return True if s == "#" else False

def parse(inp):
    H, W = map(int, next(inp).split())
    return np.array([trans([w for w in next(inp).strip()]) for _ in range(H)])

def appender(i, j, H, W, C, S, Q):
    s = S[i, j]
    if i + 1 < H and not C[i+1, j] and np.logical_xor(s, S[i+1, j]):
        Q.append((i + 1, j))
    if i > 0 and not C[i-1, j] and np.logical_xor(s, S[i-1, j]):
        Q.append((i - 1, j))
    if j + 1 < W and not C[i, j+1] and np.logical_xor(s, S[i, j+1]):
        Q.append((i, j + 1))
    if j > 0 and not C[i, j-1] and np.logical_xor(s, S[i, j-1]):
        Q.append((i, j - 1))

def search(S, start, C):
    Q = deque([start])
    H, W = S.shape
    n0 = 0
    n1 = 0
    while Q:
        i, j = Q.popleft()
        if C[i, j]:
            continue
        else:
            C[i, j] = True
            if S[i, j] == 0:
                n0 += 1
            else:
                n1 += 1
            appender(i, j, H, W, C, S, Q)
    return n0, n1


def search_all(S):
    C = np.full_like(S, False).astype(np.bool)
    D = np.full_like(S, 0)
    ret = 0
    for i in range(S.shape[0]):
        for j in range(S.shape[1]):
            if D[i, j] == 0:
                n0, n1 = search(S, (i, j), C)
                D += C
                ret += n1 * n0
                if np.all(D):
                    return ret
                else:
                    C[:, :] = False




import sys
    
print(search_all(parse(sys.stdin)))

### FIXED CODE ###


import numpy as np
from collections import deque
import sys

def parse(inp):
    H, W = map(int, next(inp).split())
    return np.array([list(next(inp).strip()) for _ in range(H)])

dis = [0, 0, 1, -1]
djs = [1, -1, 0, 0]

def search(S, i, j, Q, R):
    H, W = S.shape
    R[i, j] = True
    Q.append((i, j))
    n0 = 0
    n1 = 0
    while Q:
        i, j = Q.popleft()
        if S[i, j] == "#":
            n1 += 1
        else:
            n0 += 1
        gen = ((i + di, j + dj) for di, dj in zip(dis, djs))
        ijs = (g for g in gen if 0 <= g[0] and g[0] < H and 0 <= g[1] and g[1] < W)
        for ni, nj in ijs:
            if not R[ni, nj] and S[ni, nj] != S[i, j]:
                R[ni, nj] = True
                Q.append((ni, nj))
    return n0 * n1


def test(S):
    i, j = 0, 0
    Q = deque()
    R = np.full(S.shape, False)
    H, W = S.shape
    n = 0
    for i in range(H):
        for j in range(W):
            if not R[i, j]:
                n += search(S, i, j, Q, R)
    return n

print(test(parse(sys.stdin)))
a, b=input().split()
 
print(min(a*(int(b)),b*(int(a) ) )


### FIXED CODE ###

a, b = input().split()
 
print(min(a*int(b), b*int(a) ) )
N,M,V,P = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse= True)
#print(A)

ans = set()
i = 0
while(A[i] >= A[P-1]):
  ans.add(i)
  i += 1
#print(ans)

csum = [0 for _ in range(N)]
csum[P-1] = A[P-1]
for i in range(P,N):
  csum[i] = csum[i-1]+A[i]

for i in range(P,N):
  if A[i]+M >= (csum[i-1]+((V-P)*M-(N-1-i)*M)+1)//(i-(P-1)):
    ans.add(i)
#print(ans)

print(len(ans)-1)


### FIXED CODE ###

N,M,V,P = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse= True)

def check(i):
  if i <= P-1:
    return True
  vote = (V-1)*M
  vote -= (N-1-i)*M
  vote -= (P-1)*M
  if vote <= 0:
    return A[i]+M >= A[P-1]
  else:
    for j in range(i-1,P-1,-1):
      if A[j] > A[i]+M:
        return False
      v = min(A[i]+M-A[j],M,vote)
      vote -= v
      if vote <= 0:
        break
    if vote <= 0:
      return A[i]+M >= A[P-1]
    else:
      return A[i]+M >= A[P-1]+vote

ok = -1
ng = N
while(ok+1 < ng):
  md = (ok+ng)//2
  if check(md):
    ok = md
  else:
    ng = md
print(ok+1)
N = int(input())
S = input()
for i in range(N-1):
    if S[i] == S[i+1]:
        i += 1
        N -= 1
print(N)

### FIXED CODE ###

A, B = map(int, input().split())
if A - 2*B >= 0:
    print(A - 2*B)
else:
    print(0)
s = input()
if s = 'A':
  print('T')
elif s = 'T':
  print('A')
elif s = 'G':
  print('C')
else:
  print('G')

### FIXED CODE ###

s = input()
if s == 'A':
  print('T')
elif s == 'T':
  print('A')
elif s == 'G':
  print('C')
else:
  print('G')
import numpy as np

X, N = list(map(int, input().split()))
p_list = list(map(int, input().split()))

num_list = list(set([*range(1,101)]) - set(p_list))

diff = np.abs(np.array(num_list)-X)
diff_arg_min = np.argmin(diff)

print(num_list[diff_arg_min])

### FIXED CODE ###

import numpy as np

X, N = list(map(int, input().split()))
p_list = set(sorted(list(map(int, input().split()))))

if N == 0:
  print(X)
  exit()
  
i = sorted(list(set(range(X-N, X+1)) - p_list))[-1]
j = sorted(list(set(range(X, X+N+1)) - p_list))[0]

if X-i <= j-X:
  print(i)
else:
  print(j)
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
N, K = map(int, input().split())
A = list(map(int, input().split()))
L = []
B = set(A)
for i in B:
    L.append(A.count(i))
L.sort()
if len(B) <= K:
    print('0')
else:
    print(str(sum(L[0:len(B)-K])))

if __name__ == "__main__":
    main()


### FIXED CODE ###

#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = set(A)
    L = [0 for i in range(N+1)]
    for i in A:
        L[i] += 1
    L.sort()
    if len(B) <= K:
        print('0')
    else:
        print(str(sum(L[0:N+1-K])))


if __name__ == "__main__":
    main()
n = int(input())
h = list(map(int, input().split()))

times = []
count = 0
pos = 0

for i in range(n-1):
  if h[pos] >= h[pos+1]:
    count += 1
    pos += 1
  else:
    times.append(count)
    count = 0
    pos += 1

  times.append(count)
    
print(max(times))

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))

times = []
count = 0
pos = 0

for i in range(n-1):
  if h[pos] >= h[pos+1]:
    count += 1
    pos += 1
  else:
    times.append(count)
    count = 0
    pos += 1

  times.append(count)
  
if n == 1:
  print(0)
else:
  print(max(times))
k = int(input())
seven = 7
count = 0

def main():
    for i in range(1000000):
        if k % 2 == 0:
            count = -1
            return

        elif seven % k == 0:
            count += 1
            print(count)
            return
        else:
            count += 1
            seven = seven * 10 + 7
    print(-1)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    k = int(input())
    num = 1
    n = 7

    if (k % 2 == 0):
        print(-1)
        return
    
    for i in range(1000000):
        if (n % k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7) %k
            num += 1
    print(-1)

if __name__ == '__main__':
    main()
n=int(input())
a=[]
cnt=0
for i in range(n):
  s=input()
  s=sorted(s)
  a.append(s)
b=set(a)
for i in b:
  x=a.count(i)
  if x>0:
    cnt+=x*(x-1)//2
print(cnt)


### FIXED CODE ###

import collections

n=int(input())
lst=[]
ans=0

for i in range(n):
    s=input()
    lst.append(''.join(sorted(s)))

c=collections.Counter(lst)

for i in set(lst):
    x=c[i]

    ans+=x*(x-1)//2


print(ans)
listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
        
N = listA[0][0]
M = listA[0][1]

ans = [0] * N
pena = [0] * N

for i in range(M):
    num=listA[i+1][0] -1
    res=listA[i+1][1]
    if(res=="WA" and ans[num] == 0):
        pena[num] =  pena[num]+1
    if(res=="AC"):
        ans[num] = ans[num] + 1            
        
print('%d %d' % (sum(ans), sum(pena) ))

### FIXED CODE ###

listA=[] #appendのために宣言が必要
while True:
    try:
        listA.append(input().split())
    except:
        break;
        
N = int(listA[0][0])
M = int(listA[0][1])

ans = [0] * N
pena = [0] * N

for i in range(1, M+1):
    num=int(listA[i][0]) -1
    res=listA[i][1]
    if res=="WA" and ans[num] == 0:
        pena[num] =  pena[num]+1
    if res=="AC" and ans[num] == 0:
        ans[num] = 1
        
print('%d %d' % (sum(ans), sum(x*y for x,y in zip(ans,pena)  ) ))
n,m = map(int, input().split())
ans = 0
a = list(map(int, input().split()))
b = [0]*(n+1)
for i in range(1,n+1):
  b[i] = (a[i-1] + b[i-1])%m
f = [0]*m
for i in b:
  f[i] += 1
for i in f:
  ans += i*(i-1)//2
print(ans)

### FIXED CODE ###

from collections import defaultdict as dd
d = dd(int)
d[0] = 1
n,m = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
f = 0
for i in range(1,n+1):
  f = (f + a[i-1])%m
  d[f] += 1
for i in d:
  ans += d[i]*(d[i]-1)//2
print(ans)
a,b= map(int,raw_input().split())
if a<b :
  print 'a<b'
elif a>b 
  print 'a>b'
else:
  print 'a==b' 

### FIXED CODE ###

a,b= map(int,input().split());
if a < b :
	print("a < b" );
elif a > b :
	print("a > b" );
elif a == b :
	print("a == b") ;
# -*- coding: utf-8 -*-

def input_int_array():
    return map(int, input().split())


def f(x, m):
    return x % m


def find_index(a, x, count):
    for i in range(count):
        ai = a[i]
        if ai == x:
            return i
    return -1


def answer(n, x, m):
    a1 = x
    ai = a1
    loop_start = -1
    loop_end = n
    a[1] = a1
    ans = a1
    for i in range(2, n + 1):
        ai = f(ai**2, m)
        a[i] = ai
        ans += ai
        index = find_index(a, ai, i)
        if index >= 0:
            loop_start = index
            loop_end = i
            break
    if loop_start < 0:
        print(ans)
        return
    ans -= ai
    loop_count, remaining = divmod(n - (loop_start - 1), loop_end - loop_start)
    if loop_count > loop_start:
        start_ans = 0
        for i in range(1, loop_start):
            start_ans += a[i]
        loop_sum = ans - start_ans
    else:
        for i in range(loop_start, loop_end):
            loop_sum += a[i]
    ans += loop_sum * (loop_count-1)
    for i in range(loop_start, loop_start + remaining):
        ans += a[i]
    print(ans)


n, x, m = input_int_array()
a = [-2] * (m)

answer(n, x, m)


### FIXED CODE ###

# -*- coding: utf-8 -*-

def input_int_array():
    return map(int, input().split())


def answer(n, x, m):
    a1 = x
    ai = a1
    loop_start = -1
    loop_end = n
    a[1] = a1
    ans = a1
    for i in range(2, n + 1):
        ai = ai*ai % m
        a.append(ai)
        ans += ai
        for j in range(1, i):
            if a[j] == ai:
                loop_start = j
                loop_end = i
                break
        if loop_start >= 0:
            break
    if loop_start < 0 or ai == 0:
        print(ans)
        return
    ans -= ai
    loop_count, remaining = divmod(n - (loop_start - 1), loop_end - loop_start)
    if loop_count > loop_start:
        start_ans = 0
        for i in range(1, loop_start):
            start_ans += a[i]
        loop_sum = ans - start_ans
        ans += loop_sum * (loop_count-1)
        for i in range(loop_start, loop_start + remaining):
            ans += a[i]
    else:
        for i in range(loop_start, loop_end):
            if i < remaining:
                ans += a[i]
            loop_sum += a[i]
        ans += loop_sum * (loop_count-1)
    print(ans)


n, x, m = input_int_array()
a = [0, 0]

answer(n, x, m)
a,b,c = map(int,input().split())

if c - a - b < 0:
  print("No")
elif Decimal(c**0.5 - a**0.5 - b**0.5) > 0
  print("Yes")
else:
  print("No")

### FIXED CODE ###


a,b,c = map(int,input().split())

if 4*a*b - (c - a - b) ** 2 < 0 and c - a - b > 0:
  print("Yes")
  
else:
  print("No")
import sys

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


def resolve():
    A, B, C, D, E, F = map(int, input().split())
    W = set()
    for a in range(F // (100 * A) + 1):
        for b in range(F // (100 * B) + 1):
            if 0 < 100 * A * a + 100 * B * b <= F:
                W.add(100 * A * a + 100 * B * b)
    W = sorted(list(W))

    kouho = []
    for w in W:
        max_S = (w // 100) * E
        tmp = 0
        for c in range(0, max_S + 1, C):
            for d in range(0, max_S + 1 - c, D):
                s = c + d
                total = s + w
                if total <= F:
                    tmp = max(tmp, s)
        kouho.append([w + tmp, tmp])

    ma = 0
    for total, sugar in kouho:
        noudo = (sugar * 100) / total
        if ma < noudo:
            ma = noudo
            res = [total, sugar]
    print(*res)


if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import sys

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


def resolve():
    A, B, C, D, E, F = map(int, input().split())
    W = set()
    for a in range(F // (100 * A) + 1):
        for b in range(F // (100 * B) + 1):
            if 0 < 100 * A * a + 100 * B * b <= F:
                W.add(100 * A * a + 100 * B * b)
    W = sorted(list(W))
    kouho = []
    for w in W:
        max_S = (w // 100) * E
        tmp = 0
        for c in range(0, max_S + 1, C):
            for d in range(0, max_S + 1 - c, D):
                s = c + d
                if s + w <= F:
                    tmp = max(tmp, s)
        kouho.append([w + tmp, tmp])

    ma = 0
    res = [W[0], 0]
    for total, sugar in kouho:
        noudo = (sugar * 100) / total
        if ma < noudo:
            ma = noudo
            res = [total, sugar]

    print(*res)


if __name__ == '__main__':
    resolve()
K = int(input())

sevens = 7
count = 0

while(sevens % K !=0):
  count += 1
  sevens = sevens * 10 + 7
  if count > K:
    print(-1)
	break
    
print(count)

### FIXED CODE ###

K = int(input())
 
sevens = 7 % K
count = 1
 
while(sevens % K !=0):
  sevens = sevens * (10 % K) + (7 % K)
  sevens = sevens % K
  count += 1
  if count > K:
    count = -1
    break
    
print(count)
from collections import  defaultdict

s = input()
x, y = map(int, input().split())
N = len(s)

# 0: x-direction, 1: y-direction
dist = {0: [], 1: []}
current = 0
temp = 0
for move in s:
    if move == 'F':
        temp += 1
    else:
        dist[current].append(temp)
        n_move[current] += 1
        temp = 0
        current ^= 1
if temp > 0:
    dist[current].append(temp)
    n_move[current] += 1
        
xdp = {i: defaultdict(bool) for i in range(len(dist[0]))}
ydp = {i: defaultdict(bool) for i in range(len(dist[1]))}

xdp[0][dist[0][0]] = True
for i in range(1, len(dist[0])):
    d = dist[0][i]
    for j in range(-N, N+1):
        xdp[i][j] = xdp[i-1][j-d] | xdp[i-1][j+d] 

ydp[0][dist[1][0]] = True
ydp[0][-dist[1][0]] = True
for i in range(1, len(dist[1])):
    d = dist[1][i]
    for j in range(-N, N+1):
        ydp[i][j] = ydp[i-1][j-d] | ydp[i-1][j+d] 

if xdp[len(dist[0])-1][x] & ydp[len(dist[1])-1][y]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

from collections import  defaultdict

s = input()
x, y = map(int, input().split())

s_splitted = s.split('T')
x -= len(s_splitted[0])

dist = {0: [], 1: []} # 0: x-direction, 1: y-direction
for i, Fs in enumerate(s_splitted[1:]):
    dist[(i+1) % 2].append(len(Fs))

reachable = {0: set([0]), 1: set([0])}

for i in range(2):
    for d in dist[i]:
        temp = []
        for r in reachable[i]:
            temp.append(r+d)
            temp.append(r-d)
        reachable[i] = set(temp)

if x in reachable[0] and y in reachable[1]:
    print('Yes')
else:
    print('No')
s = input()
n = len(s)
answer = 0


for i in range(2**(n-1)):
    calc_str = s[0]
    operator_maker = str(format(i, 'b')).zfill(n-1)
    for j, c in enumerate(operator_maker):
        if c == '1':
            calc_str += '+'
        calc_str += s[j+1]
    answer += eval(calc_str)

print(answer)

### FIXED CODE ###

s = input()
n = len(s)
answer = 0


for i in range(2**(n-1)):
    calc_str = s[0]
    operator_maker = str(format(i, 'b')).zfill(n-1)
    for j, c in enumerate(operator_maker):
        if c == '1':
            calc_str += '+'
        if n != 1:
            calc_str += s[j+1]
    answer += eval(calc_str)

print(answer)