Harryxun/stf_run huggingface dataset:
import math
N = int(input())
S = str(input())

if N == 1:
    print('No')
    exit()

n = math.ceil(N/2)
j = True

try:
    for i in range(n):
    if S[i] != S[i + n]:
        j = False
except:
    break

if j:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

import math
N = int(input())
S = str(input())

if N == 1:
    print('No')
    exit()
if N%2 == 1:
    print('No')
    exit()

n = (N//2)
j = True


for i in range(n):
    if S[i] != S[i + n]:
        j = False

if j:
    print('Yes')
else:
    print('No')
from collections import deque

import sys
input = sys.stdin.buffer.readline

N = int(input())
edges = [[] for _ in range(N)]

for _ in range(N - 1):
    fr, to = map(lambda a: int(a) - 1, input().split())
    edges[fr].append(to)
    edges[to].append(fr)

dist = [10**10] * N
que = deque([(0, 0)])
while que:
    now, d = que.popleft()

    if dist[now] <= d:
        continue
    dist[now] = d

    for to in edges[now]:
        que.append((to, d + 1))

A = [i for i, d in enumerate(dist) if d % 2 == 0]
B = [i for i, d in enumerate(dist) if d % 2 == 1]

if len(A) > len(B):
    A, B = B, A

ans = [-1] * N

if len(A) <= N // 3:
    nums = set(range(1, N + 1))
    now = 3
    for i in A:
        ans[i] = now
        nums.remove(now)
        now += 3
    nums = list(nums)
    for i, n in zip(B):
        ans[i] = n
else:
    now = 0
    nums = set(range(1, N + 1))
    for i in A:
        if now + 1 > N:
            break
        ans[i] = now + 1
        nums.remove(now + 1)
        now += 3
    now = 0
    for i in B:
        if now + 2 > N:
            break
        ans[i] = now + 2
        nums.remove(now + 2)
        now += 3
    now = 3
    for i, a in enumerate(ans):
        if a == -1:
            ans[i] = now
            now += 3

print(*ans)

### FIXED CODE ###

from collections import deque

import sys
input = sys.stdin.buffer.readline

N = int(input())
edges = [[] for _ in range(N)]

for _ in range(N - 1):
    fr, to = map(lambda a: int(a) - 1, input().split())
    edges[fr].append(to)
    edges[to].append(fr)

dist = [10**10] * N
que = deque([(0, 0)])
while que:
    now, d = que.popleft()

    if dist[now] <= d:
        continue
    dist[now] = d

    for to in edges[now]:
        que.append((to, d + 1))

A = [i for i, d in enumerate(dist) if d % 2 == 0]
B = [i for i, d in enumerate(dist) if d % 2 == 1]

if len(A) > len(B):
    A, B = B, A

ans = [-1] * N
nums = set(range(1, N + 1))

if len(A) <= N // 3:
    mul = 1
    for i in A:
        ans[i] = 3 * mul
        nums.remove(3 * mul)
        mul += 1
    nums = list(nums)
    for i, n in zip(B, nums):
        ans[i] = n
else:
    mul = 1
    for c, i in enumerate(A):
        if c * 3 + 1 > N:
            ans[i] = mul * 3
            mul += 1
        else:
            ans[i] = c * 3 + 1
    for c, i in enumerate(B):
        if c * 3 + 2 > N:
            ans[i] = mul * 3
            mul += 1
        else:
            ans[i] = c * 3 + 2

print(*ans)
n = int(input())
arr = list(map(int, input().split()))
k = int(input())
for _ in range(k):
  a,b = map(int, input().split())
  arr[arr.index(a)] = b
  print(sum(arr))

### FIXED CODE ###

n = int(input())
arr = list(map(int, input().split()))
k = int(input())
s = sum(arr)
d = {}
for i in arr:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
for _ in range(k):
    v = 0
    a,b = map(int, input().split())
    if a not in d:
        print(s)
        continue
    s += (b-a) * d[a]
    if b in d:
        d[b] += d[a]
    else:
        d[b] = d[a]
    print(s)
    del d[a]
N = int(input())

n = 1000 - N
if 1000 < N:
  m = n * (-1)
else:
  m = n

print(int(str(m)[-3])*100)

### FIXED CODE ###

N = int(input())

n = 1000 - N
if N == 2000 or N == 3000 or N == 4000 or N ==5000 or N == 6000 or N == 7000 or N == 8000 or N == 9000 or N == 10000or N == 0:
  print(0)
elif 1000 < N:
  m = n * (-1)
  if m < 10:
    print(1000-m)
  elif m < 100:
    print(1000-(int(str(m)[-2])*10) + (int(str(m)[-1])))
  else:
    print(1000-((int(str(m)[-3])*100) + (int(str(m)[-2])*10) + (int(str(m)[-1]))))
else:
  print(n)
from collections import Counter
from collections import deque

if __name__ == '__main__':
    n = int(input())
    vs0 = []
    vs1 = []
    for i,v in enumerate(map(int, input().split())):
        if i % 2 == 0:
            vs0.append(v)
        else:
            vs1.append(v)
    vs0 = deque(sorted(Counter(vs0).items(), key=lambda t: t[0]))
    vs1 = deque(sorted(Counter(vs1).items(), key=lambda t: t[0]))
    t0 = vs0.pop()
    t1 = vs1.pop()
    if t0[0] != t1[0]:
        vs0 = (t[1] for t in vs0)
        vs1 = (t[1] for t in vs1)
        print(sum(vs0) + sum(vs1))
    else:
        if len(vs1) == 0:
            if len(vs0) == 0:
                print(t1[1])
            else:
                vs0 = (t[1] for t in vs0)
                print(sum(vs0))
        elif len(vs0) == 0:
            vs1 = (t[1] for t in vs1)
            print(sum(vs1))
        else:
            t00 = vs0.pop()
            t11 = vs1.pop()
            a = t00 + t1
            b = t11 + t0
            print(sum(vs0) + sum(vs1) + (a if a < b else b))



### FIXED CODE ###

from collections import Counter
from collections import deque

if __name__ == '__main__':
    n = int(input())
    vs0 = []
    vs1 = []
    for i,v in enumerate(map(int, input().split())):
        if i % 2 == 0:
            vs0.append(v)
        else:
            vs1.append(v)
    vs0 = deque(sorted(Counter(vs0).items(), key=lambda t: t[1]))
    vs1 = deque(sorted(Counter(vs1).items(), key=lambda t: t[1]))
    t0 = vs0.pop()
    t1 = vs1.pop()
    if t0[0] != t1[0]:
        vs0 = (t[1] for t in vs0)
        vs1 = (t[1] for t in vs1)
        print(sum(vs0) + sum(vs1))
    else:
        if len(vs1) == 0:
            if len(vs0) == 0:
                print(t1[1])
            else:
                vs0 = (t[1] for t in vs0)
                print(sum(vs0))
        elif len(vs0) == 0:
            vs1 = (t[1] for t in vs1)
            print(sum(vs1))
        else:
            t00 = vs0.pop()
            t11 = vs1.pop()
            a = t00[1] + t1[1]
            b = t11[1] + t0[1]
            vs0 = (t[1] for t in vs0)
            vs1 = (t[1] for t in vs1)
            print(sum(vs0) + sum(vs1) + (a if a < b else b))
N = map(int, input().split())
h = list(map(int, input().split()))

loc_max = h[0]
count = 0

for i in range(1, N):
    if h[i] >= loc_max:
        loc_max = h[i]
    if h[i] < h[i-1]:
        count = count + loc_max - h[i]
        loc_max = 0
    if i == N-1:
        count = count + h[i]

print(count)

### FIXED CODE ###

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

count = 0

for i in range(N-1):
    if h[i] > h[i+1]:
        count = count + h[i] - h[i+1]

count = count + h[N-1]

print(count)
n, k = map(int, input().split())
hs = list(map(int, input().split()))
dp = [0] * float('inf')
dp[0] = 0
for i in range(1, n):
  pre = min(i, k)
  while pre > 0:
    dp[i] = min(dp[i], dp[i-pre] + abs(hs[i-pre] - hs[i]))
    pre -= 1
print(dp[-1])

### FIXED CODE ###

n, k = map(int, input().split())
hs = list(map(int, input().split()))
dp = [float('inf')] * n
dp[0] = 0
for i in range(1, n):
  pre = min(i, k)
  while pre > 0:
    dp[i] = min(dp[i], dp[i-pre] + abs(hs[i-pre] - hs[i]))
    pre -= 1
print(dp[-1])
n = int(input())
xyz = []
for i in range(n):
    xyz.append(list(map(int,input().split())))

for cx in range(101):
    for cy in range(101):
        mh = 1000000000
        h = []
        for i in range(n):
            x,y,z = xyz[i][0],xyz[i][1],xyz[i][2]
            if z == 0:
                mh = min(mh,abs(x-cx)+abs(y-cy))
            else:
                if len(h) == 0:
                    h.append(z+abs(x-cx)+abs(y-cy))
                else:
                    if h[0] != z+abs(x-cx)+abs(y-cy):
                        h = []
                        break
                    elif h[0]>mh:
                        h = []
                        break
        if len(h) > 0:
            ans = str(cx)+" "+str(cy)+" "+str(h[0])
print(ans)

### FIXED CODE ###

n = int(input())
xyz = []
for i in range(n):
    xyz.append(list(map(int,input().split())))

for cx in range(101):
    for cy in range(101):
        mh = 10000000000
        h = []
        for i in range(n):
            x,y,z = xyz[i][0],xyz[i][1],xyz[i][2]
            if z == 0:
                mh = min(mh,abs(x-cx)+abs(y-cy))
            else:
                if len(h) == 0:
                    h.append(z+abs(x-cx)+abs(y-cy))
                else:
                    if h[0] != z+abs(x-cx)+abs(y-cy):
                        h = []
                        break
                    elif h[0]>mh:
                        h = []
                        break
            if len(h)>0 and h[0]>mh:
                h = []
                break
        if len(h) > 0:
            ans = str(cx)+" "+str(cy)+" "+str(h[0])
print(ans)
a,b = list(map(int,input().split()))

A = list(range(int((a / 0.08)),int((a+1)/0.08))-1)
B = list(range(int((b / 0.1)),int((b+1)/0.1))-1)
price = set(A) & set(B)
if len(price) == 0:
    ans = -1
else:
    ans = min(price)
print(ans)

### FIXED CODE ###

import math
a,b = list(map(int,input().split()))

A = list(range(math.ceil((a / 0.08)),int((a+1)/0.08)))
B = list(range(int((b / 0.1)),int((b+1)/0.1)-1))
price = set(A) & set(B)
if len(price) == 0:
    ans = -1
else:
    ans = min(price)
print(ans)
N,S.K=map(int,input().split())
ans=[S]*K +[S+1]*(N-K)
print(*ans)

### FIXED CODE ###

N, K, S = map(int, input().split())

ans = [0]*N
T = 10**9
if T == S:
    T = 10**9 - 1
for i in range(N):
    if i < K:
        ans[i] = S
    else:
        ans[i] = T
print(" ".join(map(str, ans)))
from functools import reduce
from math import gcd
N, X = map(int, input().split())
loc = list(map(int, input().split()))

print(reduce(gcd, [abs(l-X) for l in loc]))

### FIXED CODE ###

from functools import reduce
N, X = map(int, input().split())
loc = list(map(int, input().split()))


def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


print(reduce(gcd, [abs(l-X) for l in loc]))
A,B=input().split()

mydict = {"A":11, "B":12, "C":14, "D":13, "E":14, "F":15}

print('>') if mydict(A) > mydict(B) else print('<') if mydict(A) < mydict(B) else print('=')


### FIXED CODE ###

A,B=input().split()

mydict = {"A":10, "B":11, "C":12, "D":13, "E":14, "F":15}

print('>') if mydict[A] > mydict[B] else print('<') if mydict[A] < mydict[B] else print('=')
import sys; readline = sys.stdin.readline
from collections import deque

N, U, V = map(int, readline().split())
AB = [list(map(int, readline().split())) for i in range(N - 1)]

A = [a - 1 for a, b in AB]
B = [b - 1 for a, b in AB]

U, V = U - 1, V - 1

conn = {}
for a, b in zip(A, B):
    if not a in conn:
        conn[a] = []
    conn[a].append(b)

    if not b in conn:
        conn[b] = []
    conn[b].append(a)

t = [0 for i in range(N)]

def dfsU(u, parent, depth):
    t[u] = depth

    for _u in conn[u]:
        if _u != parent:
            dfsU(_u, u, depth + 1)

dfsU(V, -1, 0)

maxv = 0
maxu = U
def dfsV(v, parent, depth):
    global maxv
    global maxu
    if depth < t[v]:
        if t[v] > maxv:
            maxv = t[v]
            maxu = depth
        for _v in conn[v]:
            if _v != parent:
                dfsV(_v, v, depth + 1)

dfsV(U, -1, 0)
if (maxv - maxu) % 2 == 1:
    print(maxv - 1)
else:
    print(maxv - 1)

### FIXED CODE ###

import sys; readline = sys.stdin.readline
from collections import deque
sys.setrecursionlimit(1000000)

N, U, V = map(int, readline().split())
AB = [list(map(int, readline().split())) for i in range(N - 1)]

A = [a - 1 for a, b in AB]
B = [b - 1 for a, b in AB]

U, V = U - 1, V - 1

conn = {}
for a, b in zip(A, B):
    if not a in conn:
        conn[a] = []
    conn[a].append(b)

    if not b in conn:
        conn[b] = []
    conn[b].append(a)

t = [0 for i in range(N)]

def dfsU(u, parent, depth):
    t[u] = depth

    for _u in conn[u]:
        if _u != parent:
            dfsU(_u, u, depth + 1)

dfsU(V, -1, 0)

maxv = 0
maxu = U
def dfsV(v, parent, depth):
    global maxv
    global maxu
    if depth < t[v]:
        if t[v] > maxv:
            maxv = t[v]
            maxu = depth
        for _v in conn[v]:
            if _v != parent:
                dfsV(_v, v, depth + 1)

dfsV(U, -1, 0)
if (maxv - maxu) % 2 == 1:
    print(maxv - 1)
else:
    print(maxv - 1)
import numpy as np

N, M = map(int, input().split())
a = [int(input()) for i in range(M)]

ans = np.zeros(N + 1)
ans[N] = 1

if N - 1 not in a:
    ans[N - 1] = 1

for i in range(2, N + 1):
    if N - i not in a:
        ans[N - i] = (ans[N - i + 1] + ans[N - i + 2])
    else:
        ans[N - i] = 0
        
print(int(ans[0] % (10 ** 9 + 7)))

### FIXED CODE ###

N, M=map(int, input().split())
A = [int(input()) for _ in range(M)]
mod = 10**9 + 7
step = [1]*(N+1)

for a in A:
    step[a]=0
for i in range(2, N+1):
    step[i]=(step[i-1]+step[i-2])%mod*step[i]
print(step[-1])
n=int(input())
ki=[[] for _ in range(n)]

for _ in range(n-1):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    ki[a].append(b)
    ki[b].append(a)

odd=[-1]*n
odd[0]=0
todo=[0]
while todo:
    v=todo.pop()
    for nv in ki[v]:
        if odd[nv]==-1:
            odd[nv]=abs(odd[v]-1)
            todo.append(nv)
from collections import Counter
co=Counter(odd)
ans=[0]*n
if co[1]<n//3:
    cnt1=1
    cnt=2
    cnt3=1
    for i in range(n):
        if odd[i]==1 and 3*cnt3<=n:
            ans[i]=3*cnt3
            cnt3+=1
        else:
            if cnt1%3==0:cnt1+=1
            if cnt1<=n:
                ans[i]=cnt1
                cnt1+=1
            else:
                ans[i]=n-n%3-cnt2*3
                cnt2+=1

elif co[0]<n//3:
    cnt1=1
    cnt2=0
    cnt3=1
    for i in range(n):
        if odd[i]==0 and 3*cnt3<=n:
            ans[i]=3*cnt3
            cnt3+=1
        else:
            if cnt1%3==0:cnt1+=1
            if cnt1<=n:
                ans[i]=cnt1
                cnt1+=1
            else:
                ans[i]=n-n%3-cnt2*3
                cnt2+=1
else:
    cnt1=1
    cnt2=1
    cnt3=1
    for i in range(n):
        if odd[i]==0:
            if 3*cnt1-2<=n:
                ans[i]=3*cnt1-2
                cnt1+=1
            else:
                ans[i]=3*cnt3
                cnt3+=1
        else:
            if 3*cnt2-1<=n:
                ans[i]=3*cnt2-1
                cnt2+=1
            else:
                ans[i]=3*cnt3
                cnt3+=1
print(*ans,sep=' ')



### FIXED CODE ###

n=int(input())
ki=[[] for _ in range(n)]

for _ in range(n-1):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    ki[a].append(b)
    ki[b].append(a)

odd=[-1]*n
odd[0]=0
todo=[0]
while todo:
    v=todo.pop()
    for nv in ki[v]:
        if odd[nv]==-1:
            odd[nv]=abs(odd[v]-1)
            todo.append(nv)
from collections import Counter
co=Counter(odd)
ans=[0]*n
if co[1]<=n//3:
    cnt1=1
    cnt2=0
    cnt3=1
    for i in range(n):
        if odd[i]==1 and 3*cnt3<=n:
            ans[i]=3*cnt3
            cnt3+=1
        else:
            if cnt1%3==0:cnt1+=1
            if cnt1<=n:
                ans[i]=cnt1
                cnt1+=1
            else:
                ans[i]=n-n%3-cnt2*3
                cnt2+=1

elif co[0]<=n//3:
    cnt1=1
    cnt2=0
    cnt3=1
    for i in range(n):
        if odd[i]==0 and 3*cnt3<=n:
            ans[i]=3*cnt3
            cnt3+=1
        else:
            if cnt1%3==0:cnt1+=1
            if cnt1<=n:
                ans[i]=cnt1
                cnt1+=1
            else:
                ans[i]=n-n%3-cnt2*3
                cnt2+=1
else:
    cnt1=1
    cnt2=1
    cnt3=1
    for i in range(n):
        if odd[i]==1:
            if 3*cnt1-2<=n:
                ans[i]=3*cnt1-2
                cnt1+=1
            else:
                ans[i]=3*cnt3
                cnt3+=1
        else:
            if 3*cnt2-1<=n:
                ans[i]=3*cnt2-1
                cnt2+=1
            else:
                ans[i]=3*cnt3
                cnt3+=1
print(*ans,sep=' ')
N = int(input())
tree = [[] for i in range(N)]
color = [-1] * N
for i in range(N-1):
    u, v, w = map(int, input().split())
    tree[u-1].append((v-1, w))
    tree[v-1].append((u-1, w))


def dfs(u):
    for v, w in tree[u]:
        if color[v] == -1:
            color[v] = color[u] ^ (w % 2)
            dfs(v)


color[0] = 0
dfs(0)
print('\n'.join(map(str, color)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N = int(input())
tree = [[] for i in range(N)]
color = [-1] * N
for i in range(N-1):
    u, v, w = map(int, input().split())
    tree[u-1].append((v-1, w))
    tree[v-1].append((u-1, w))


def dfs(u):
    for v, w in tree[u]:
        if color[v] == -1:
            color[v] = color[u] ^ (w % 2)
            dfs(v)


color[0] = 0
dfs(0)
print('\n'.join(map(str, color)))
s = raw_input()
N = int(raw_input())
dis = [ord('z')-ord(c) for c in s]
for idx, d in enumerate(dis[:-1]):
    if d <= N:
        s[idx] = 'a'
        N -= d
if N > 0:
    N %= 27
    t = (dis[-1]-N) % 27
    s[-1] = chr(ord('z') - t)

### FIXED CODE ###

s = bytearray(raw_input())
N = int(raw_input())
dis = [ord('z')-c for c in s]

for idx, d in enumerate(dis[:-1]):
    if d!=25 and d+1 <= N:
        s[idx] = 'a'
        N -= (d+1)

if N > 0:
    N %= 26
    t = (dis[-1]-N) % 26
    s[-1] = chr(ord('z') - t)
print s
n = input()
k = input()
x = input()
y = input()
print(k*x + (n-k)*y)

### FIXED CODE ###

n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n >= k:
  print(k*x + (n-k)*y)
else:
  print(n*x)
#?????????
def mergesort(A, left, right):
 
    if left + 1 < right:
        mid = (left + right)/2
         
        mergesort(A, left, mid)
        mergesort(A, mid, right)
        merge(A, left, mid, right)
 
 
def merge(A, left, mid, right):
    
    n1 = mid -left
    n2 = right - mid
    L = []
    R = []
    x = [" "," ", float("inf")]
    for i in range(0, n1):
        L.append(A[left + i])
    for i in range(0, n2):
        R.append(A[mid + i])
    L.append(x)
    R.append(x)
    i = 0
    j = 0
    for k in range(left, right):
        if float(L[i][-1]) <= float(R[j][-1]):
            A[k] = L[i]
            i = i + 1
        else:
            A[k] = R[j]
            j = j + 1
            
            
def partition(A, p, r):
    x = float(A[r][2])
    i = p - 1
    for j in range(p, r):
        if float(A[j][2]) <= x:
            i = i + 1
            A[i],A[j]=A[j], A[i]
             
    A[i+1], A[r]=A[r], A[i+1]
    return i+1
 
def quicksort(A, p, r):
    if p < r:
        q = partition(A, p, r)
         
        quicksort(A, p, q-1)
        quicksort(A, q+1, r)
 
 
 
 
if __name__ == "__main__":
    num = int(raw_input())
    num_list = []
    num_list1 = []
    for i in range(num):
        num_list.append(raw_input())
    num_list1 = list(num_list)
    quicksort(num_list, 0, len(num_list)-1)
  
    mergesort(num_list1, 0, len(num_list1))
     
    if num_list == num_list1:
        print ("Stable")
    else:
        print ("Not stable")
    print "\n".join(num_list)

### FIXED CODE ###

def mergesort(A, left, right):
 
    if left + 1 < right:
        mid = (left + right)/2
         
        mergesort(A, left, mid)
        mergesort(A, mid, right)
        merge(A, left, mid, right)
 
 
def merge(A, left, mid, right):

    n1 = mid -left
    n2 = right - mid
    L = []
    R = []
    x = "  10000000000"
    for i in range(0, n1):
        L.append(A[left + i])
    for i in range(0, n2):
        R.append(A[mid + i])
    L.append(x)
    R.append(x)
    i = 0
    j = 0
    for k in range(left, right):
        if int(L[i][2:]) <= int(R[j][2:]):
            A[k] = L[i]
            i = i + 1
        else:
            A[k] = R[j]
            j = j + 1
            
            
def partition(A, p, r):
    x = int(A[r-1][2:])
    i = p - 1
    for j in range(p, r-1):
        if int(A[j][2:]) <= x:
            i = i + 1
            A[i],A[j]=A[j], A[i]
             
    A[i+1], A[r-1]=A[r-1], A[i+1]
    return i+1
 
def quicksort(A, p, r):
    if p < r-1:
        q = partition(A, p, r)
         
        quicksort(A, p, q)
        quicksort(A, q+1, r)
 
 
 
 
if __name__ == "__main__":
    num = int(raw_input())
    num_list = []
    num_list1 = []
    for i in range(num):
        num_list.append(raw_input())
    num_list1 = list(num_list)
    quicksort(num_list, 0, len(num_list))
  
    mergesort(num_list1, 0, len(num_list1))
     
    if num_list == num_list1:
        print ("Stable")
    else:
        print ("Not stable")
    print "\n".join(num_list)
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda x: -x[2])
for cx in range(101):
    for cy in range(101):
        good = True
        h = xyh[0][2]+abs(cx-xyh[0][0])+abs(cy-xyh[0][1])
        for i in range(n):
            if xyh[i][2] != max(h-abs(cx-xyh[i][0])-abs(cy-xyh[i][1]), 0):
                good = False
                break
        if good:
            print(cx, cy, h)
            sys.exit()

### FIXED CODE ###

import sys
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh.sort(key=lambda x: -x[2])
for cx in range(101):
    for cy in range(101):
        good = True
        h = xyh[0][2]+abs(cx-xyh[0][0])+abs(cy-xyh[0][1])
        for i in range(n):
            if xyh[i][2] != max(h-abs(cx-xyh[i][0])-abs(cy-xyh[i][1]), 0):
                good = False
                break
        if good:
            print(cx, cy, h)
            sys.exit()
N = int(input())

A = [int(x) for x in input().split()]
A = sorted(A)
A = list(set(A))

if len(A) == 1:
    print(0)
else:
    if A[0] == A[1]:
        cnt = 0
    else:
        cnt = 1
    
    for i in range(1,N):
        flag = True
        for j in range(i):
            if A[i]%A[j] == 0:
                flag = False
                break

    
        if flag == True:
            cnt += 1
    print(cnt)


### FIXED CODE ###

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

l=[0]*(10**6+1)
ans=0
#print(l)
for i in a:
    if l[i]==0:
        for j in range(i,10**6+1,i):
            l[j] += 1
    else:
        l[i] += 1
#print(l)
for i in a:
    if l[i]==1:
        ans+=1

print(ans)
from functools import reduce
from operator import mul

mod = 10**9 + 7

N, K = map(int, input().split())

A = list(map(int, input().split()))

if N == K:
    print(reduce(mul, A)%mod)

else:

    AP = []
    AM = []
    for i in A:
        if i < 0:
            AM.append(i)
        else:
            AP.append(i)
            
    if len(AP) == 0 and K%2 != 0:
        AM.sort(reverse=True)
        AM = AM[:K]
        print(reduce(mul, AM)%mod)

    else:
        
        AP.sort(reverse=True)
        AM.sort()

        AP = AP[:K]
        AM = AM[:K]

        P = reduce(mul, AP)
        M = 1
        ans = P
        for i in range(0, len(AM)):
            if i < len(AP): 
                M *= AM[i]
                ans = max(ans, P*M/AP[-(i+1)])

        print(int(ans)%mod)

### FIXED CODE ###

from bisect import bisect_left,bisect_right
p=10**9+7
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
pi=1
ni=0
ans=1
i=0
while i<k-1:
  if a[ni]*a[ni+1]>a[-pi]*a[-pi-1]:
    ans=ans*a[ni]*a[ni+1]%p
    ni+=2
    i+=2
  else:
    ans=ans*a[-pi]%p
    pi+=1
    i+=1
if i==k-1:
  ans=ans*a[-pi]%p
if a[-1]<0 and k%2==1:
  ans=1
  for i in a[n-k:]:
    ans=ans*i%p
print(ans)
import sys

input = sys.stdin.readline()

s = input()
n = len(s)

total_sum = 0
# +を挿入する事象は
# sが2文字なら2通り,3文字なら4通り,n文字なら2^(n-1)通りある
for i in range(2 ** (n - 1)):
    # iは各桁に+を挿入するかどうかを決定する
    # 例えば s=12345, i=0b0111, ss=1+2+3+45
    now_sum = 0
    reg = int(s[0])
    for j in range(n - 1):
        if i & 1 << j:
            now_sum += reg
            reg = 0
        reg *= 10
        reg += int(s[j + 1])
    now_sum += reg

    total_sum += now_sum

print(total_sum)


### FIXED CODE ###

# ARC061C - たくさんの数式 / Many Formulas (ABC045C)
from itertools import product


def main():
    s = input()
    ans = 0
    ops = tuple(product(("", "+"), repeat=len(s) - 1))
    for op in ops:
        e = ""
        for i in range(len(s) - 1):
            e += s[i] + op[i]
        e += s[-1]
        ans += eval(e)
    print(ans)


if __name__ == "__main__":
    main()