Harryxun/stf_run huggingface dataset:
n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 1

if k == n:
    for i in range(n):
        ans *= a[i]
        ans %= mod
    print(ans)
    exit()
if max(a) < 0 and k%2 == 1:
    a.sort(reverse=True)
    for i in range(k):
        ans *= a[i]
        ans %= mod
    print(ans)
    exit()

a.sort(key=lambda x: abs(x))
cnt = 0
for i in range(1, k+1):
    ans *= abs(a[-i])
    ans %= mod
    if a[-i] < 0:
        cnt += 1

if cnt%2 == 0:
    print(ans)
else:
    a_plus = None
    a_minus = None
    b_plus = None
    b_minus = None
    for i in range(k, 0, -1):
        if a[-i] >= 0 and a_plus == None:
            a_plus = abs(a[-i])
        if a[-i] < 0 and a_minus == None:
            a_minus = abs(a[-i])
    for i in range(k+1, n+1):
        if a[-i] >= 0 and b_plus == None:
            b_plus = abs(a[-i])
        if a[-1] < 0 and b_minus == None:
            b_minus = abs(a[-i])
    if a_plus == None or b_minus == None:
        ans *= pow(a_minus, mod-2, mod)
        ans %= mod
        ans *= b_plus
        ans %= mod
    elif a_minus == None or b_plus == None:
        ans *= pow(a_plus, mod-2, mod)
        ans %= mod
        ans *= b_minus
        ans %= mod
    else:
        if a_plus*b_plus > a_minus*b_minus:
            ans *= pow(a_minus, mod-2, mod)
            ans %= mod
            ans *= b_plus
            ans %= mod
        else:
            ans *= pow(a_plus, mod-2, mod)
            ans %= mod
            ans *= b_minus
            ans %= mod
    print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10**9 + 7
ans = 1

if k == n:
    for i in range(n):
        ans *= a[i]
        ans %= mod
    print(ans)
    exit()
if max(a) < 0 and k%2 == 1:
    a.sort(reverse=True)
    for i in range(k):
        ans *= a[i]
        ans %= mod
    print(ans)
    exit()

a.sort(key=lambda x: abs(x))
cnt = 0
for i in range(1, k+1):
    ans *= a[-i]
    ans %= mod
    if a[-i] < 0:
        cnt += 1

if cnt%2 == 0:
    print(ans)
else:
    a_plus = None
    a_minus = None
    b_plus = None
    b_minus = None
    for i in range(k, 0, -1):
        if a[-i] >= 0 and a_plus == None:
            a_plus = a[-i]
        if a[-i] < 0 and a_minus == None:
            a_minus = a[-i]
    for i in range(k+1, n+1):
        if a[-i] >= 0 and b_plus == None:
            b_plus = a[-i]
        if a[-i] < 0 and b_minus == None:
            b_minus = a[-i]
    if a_plus == None or b_minus == None:
        ans *= pow(a_minus, mod-2, mod)
        ans %= mod
        ans *= b_plus
        ans %= mod
    elif a_minus == None or b_plus == None:
        ans *= pow(a_plus, mod-2, mod)
        ans %= mod
        ans *= b_minus
        ans %= mod
    else:
        if abs(a_plus*b_plus) > abs(a_minus*b_minus):
            ans *= pow(a_minus, mod-2, mod)
            ans %= mod
            ans *= b_plus
            ans %= mod
        else:
            ans *= pow(a_plus, mod-2, mod)
            ans %= mod
            ans *= b_minus
            ans %= mod
    print(ans)
s=input()
s.upper()
week=['sun','mon','tue','wed','thu','fri','sat']
ans=week.index(s)
print(7-ans)

### FIXED CODE ###

s=input()
s=s.lower()
week=['sun','mon','tue','wed','thu','fri','sat']
ans=week.index(s)
print(7-int(ans))
import pandas as pd
import math

N = int(input())
S = ["".join(sorted(input())) for i in range(N)]
df = pd.DataFrame(S, columns=["value"])


def combinations_count(n, r):
    if n == 1:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


grouped = df.groupby("value")
sizes = grouped.size().values
ans = sum([combinations_count(size, 2) for size in sizes])
print(ans)


### FIXED CODE ###

import math
from itertools import groupby

N = int(input())
S = ["".join(sorted(input())) for i in range(N)]
sizes = [len(list(v)) for k, v in groupby(sorted(S))]


def combinations_count(n, r):
    if n == 1:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


ans = sum([combinations_count(size, 2) for size in sizes])
print(ans)
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
numk={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
dp=[0]+[-float('inf')]*(N)
for i in range(N):
  for j in A:
    if i+numk[j]<=N:
      dp[i+numk[j]]=max(dp[i+numk[j]],dp[i]+1)
m=N
ans=[]
while m>0:
  for i in range(M):
    if dp[m-numk[A[i]]]+1==dp[m]:
      ans.append(A[i])
      m-=numk[A[i]]
ans.sort(reverse=True)
for i in range(len(ans)):
  ans[i]=str(ans[i])
a=''.join(ans)
print(a)

### FIXED CODE ###

N,M=map(int,input().split())
num={1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
A=list(map(int,input().split()))
A.sort(reverse = True)
dp = [0]+[-1]*(N+1)
for i in range(N):
    for j in A:
        if i+num[j]<=N:
            dp[i+num[j]] = max(dp[i+num[j]],dp[i]+1)
ans = []
m=N
while m>0:
    for i in A:
        if m-num[i]>=0 and dp[m-num[i]]==dp[m]-1:
          m-=num[i]
          ans.append(str(i))
          break
print("".join(ans))
a,b=map(int,input().split())
print(int(a*b))

### FIXED CODE ###

a,b=map(str,input().split())
import math
a=int(a)
B=int(b[0]+b[2]+b[3])
print(int(a*B//100))
n=int(input())
z=0
for i in range(n):
  a,b=input().split()
  if b=="BTC":
    z += a*380000
  else:
    z += a
print(z)

### FIXED CODE ###

s=input()
if(s>"2019/04/30"):
   print("TBD")
else:
   print("Heisei")
import math, cmath

def koch(p1, p2, n):

    rad60 = math.pi/3
    v1 = (p2 - p1)/3
    v2 = cmath.rect(abs(v1), cmath.phase(v1)+rad60)
    q1 = p1 + v1
    q2 = q1 + v2
    q3 = q1 + v1
    if n == 1:
        return [p1,q1,q2,q3,p2]
    else:
        x1 = koch(p1,q1,n-1)[1:-1]
        x2 = koch(q1,q2,n-1)[1:-1]
        x3 = koch(q2,q3,n-1)[1:-1]
        x4 = koch(q3,p2,n-1)[1:-1]
        x = [p1]+x1+[q1]+x2+[q2]+x3+[q3]+x4+[p2]
    return x

n = int(raw_input())
p1 = complex(0,0)
p2 = complex(100,0)

for e in koch(p1,p2,n):
    print e.real,e.imag

### FIXED CODE ###

import math, cmath

def koch(p1, p2, n):
    if n == 0:
        return [p1, p2]
    
    rad60 = math.pi/3
    v1 = (p2 - p1)/3
    v2 = cmath.rect(abs(v1), cmath.phase(v1)+rad60)
    q1 = p1 + v1
    q2 = q1 + v2
    q3 = q1 + v1
    if n == 1:
        return [p1,q1,q2,q3,p2]
    else:
        x1 = koch(p1,q1,n-1)[:-1]
        x2 = koch(q1,q2,n-1)[:-1]
        x3 = koch(q2,q3,n-1)[:-1]
        x4 = koch(q3,p2,n-1)
        x = x1 + x2 + x3 + x4
    return x

n = int(raw_input())
p1 = complex(0,0)
p2 = complex(100,0)

for e in koch(p1,p2,n):
    print e.real,e.imag
N=int(input())
P=[int(x) for x in input().split()]
 
N_J=list(range(1,N+1))
ans='NO'
for i in range(N):
    for j in range(N):
        P_temp=P.copy()
        p_i=P[i]
        p_j=P[j]
 
        P_temp[i]=p_j
        P_temp[j]=p_i
        
        if P==N_J:
            ans='YES'
print(ans)
N=int(input())
P=[int(x) for x in input().split()]

N_J=list(range(1,N+1))
ans='NO'
for i in range(N):
    for j in range(N):
        P_temp=P.copy()
        p_i=P[i]
        p_j=P[j]

        P_temp[i]=p_j
        P_temp[j]=p_i
        
        if P==N_J:
            ans='YES'
print(ans)

### FIXED CODE ###

N=int(input())
P=[int(x) for x in input().split()]
 
N_J=list(range(1,N+1))
ans='NO'
for i in range(N):
    for j in range(N):
        P_temp=P.copy()
        p_i=P[i]
        p_j=P[j]
 
        P_temp[i]=p_j
        P_temp[j]=p_i
        
        if P_temp==N_J:
            ans='YES'
print(ans)
K,X =int(input()),int(input())
if K*500>=X:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = input().rstrip().split()
K,X =int(s[0]),int(s[1])
if K*500>=X:
  print("Yes")
else:
  print("No")
# ducational DP Contest B-Frog 2
    
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf') for _ in range(N+K)]
dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]))
        
print(dp[N-1])

### FIXED CODE ###

# Educational DP Contest B-Frog 2

def frog(N, K, h):
    # initialize
    inf = float('inf')
    dp = [inf] * N
    
    minKN = min(K, N)
    for i in range(minKN):
        if i == 0:
            dp[i] = 0
        else: 
            dp[i] = abs(h[0] - h[i])
            for j in range(minKN):
                if j == i:
                    continue
                elif j < i:
                    dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]))
    # DP
    for i in range(N):
        if i == 0:
            continue
        elif i < K:
            continue
        else:
            dp[i] = min([abs(h[k] - h[i]) + dp[k] for k in range(i-K, i)])
    return dp[N-1]
    
if __name__ == "__main__":
    N, K = map(int, input().split())
    h = list(map(int, input().split()))
    print(frog(N, K, h))
import sys
import heapq
sys.setrecursionlimit(10000000)

def knap(i, used, cost, N, M, Key, K_cost):
    if i == N - 1:
        take = used | Key[i]
        take_cost = cost + K_cost[i]
        a = set([int(i) for i in range(N)])
        if  used == a: return cost
        elif take == a: return take_cost
        else: return -1
    else:
        take = used | Key[i]
        take_cost = knap(i+1, take, cost + K_cost[i], N, M, Key, K_cost)
        not_take_cost = knap(i+1, used, cost, N, M, Key, K_cost)
        if take_cost == not_take_cost == -1: return -1
        elif take_cost == -1: return not_take_cost
        elif not_take_cost == -1: return take_cost
        else: return min(take_cost, not_take_cost)
        

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    Key = dict()
    K_cost = dict()
    for i in range(M):
        a, b = map(int, input().split())
        K_cost[i] = a
        Key[i] = set([int(c) - 1 for c in input().split()])

    print(knap(0, set(), 0, N, M, Key, K_cost))
    return 0

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys
import heapq

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    cost = dict()
    for i in range(2 ** N): cost[i] = -1
    cost[0] = 0
    for i in range(M):
        a, b = map(int, input().split())
        c = [int(c) for c in input().split()]
        bit = 0
        for j in c: bit += 2 ** (j - 1)
        for i in range(2 ** N):
            if cost[i] > -1:
                if cost[i | bit] > -1:
                    cost[i | bit] = min(cost[i | bit], cost[i] + a)
                else: cost[i | bit] = cost[i] + a

    #print(cost)

    print(cost[2 ** N - 1])
    return 0

if __name__ == "__main__":
    solve()
a=int(input()), b=int(input())

if (a*b)%2==0:
    print("Even")

if else:
    print("Odd")

### FIXED CODE ###

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

if (a*b)%2==0:
    print("Even")

else:
    print("Odd")
# -*- coding:utf-8 -*-
H,W=map(int,input().split())
nx=[1,0,-1,0,1,1,-1,-1]
ny=[0,1,0,-1,1,-1,1,-1]

field=[]
for i in range(H):
  field.append(list(split()))

for n in range(W):
  for m in range(H):
    if field[n][m]=='.':
      continue
      
    for j in range(8):
      x=n+nx[j]
      y=m+ny[j]

      if field[x][y]=='.':
        print('No')
        exit()
      else:
        pass
print('Yes')
      
  
  

### FIXED CODE ###

H,W=map(int, input().split())
S=["."+input()+"." for _ in range(H)]
S=["."*(W+2)]+S+["."*(W+2)]
ans="Yes"
for i in range(H):
  for j in range(W):
    if S[i][j]=="#" and S[i-1][j]=="." and S[i+1][j]=="." and S[i][j-1]=="." and S[i][j+1]==".":
      ans="No"
print(ans)
a, b = map(int, input().split())
print(a*b//1)

### FIXED CODE ###

a, b = input().split()
a = int(a)
b = int(b[0])*100 + int(b[2])*10 + int(b[3])
c = a*b
print(c//100)
A, B = eval("int(input()," * 2)
if A > B:
	print("GREATER")
elif A < B:
	print("LESS")
else:
	print("EQUAL")


### FIXED CODE ###

A, B = eval("int(input())," * 2)
if A > B:
	print("GREATER")
elif A < B:
	print("LESS")
else:
	print("EQUAL")
n=int(input())
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
p=sorted(l,key=lambda x: x[0]+x[1])
q=sorted(l,key=lambda x: x[0]-x[1])
print(max(p[-1]-p[0],q[-1]-q[0]))

### FIXED CODE ###

n=int(input())
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
p=[a+b for a,b in l]
q=[a-b for a,b in l]
p.sort()
q.sort()
print(max(p[-1]-p[0],q[-1]-q[0]))
s=input()
text=['dream','dreamer','erase','eraser']

def bfs(t):
  if t == s:
    return 1
  if len(t) >= len(s):
    return 0
  if t != s[:len(t)]:
    return 0
  ans = 0
  for tx in text:
    ans += bfs(t+tx)
  return ans

if bfs('') > 0:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

import sys
s=''.join(reversed(list(input())))
t=''
text = ['maerd', 'esare', 'resare', 'remaerd']
while len(t) < len(s):
  for tx in text:
    if t + tx == s[:len(t+tx)]:
      t += tx
      break
  else:
    print('NO')
    sys.exit()
print('YES')
N = int(input())

F = [int(input().replace(" ",""),2) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(N)]


profit = float("-inf")

for i in range(1,1024):
	tmp = 0
	for j in range(N):
		tmp = tmp + (bin(i & F[j]).count('1'))
		tmp2 = P[j][tmp]
	profit = max(profit, tmp2)

print(profit)

### FIXED CODE ###

n = int(input())
     
f = [int(input().replace(" ", ""), 2) for _ in range(n)]
p = [list(map(int, input().split())) for _ in range(n)]
     
ans = float('-inf')
     
for i in range(1, 1024):
    price = 0
    for j in range(n):
        price += p[j][bin(i & f[j]).count('1')]
    ans = max(ans, price)
     
print(ans)
# coding: utf-8

if __name__ == "__main__":
	n, w = map(int,input().split())
	v, w = [], []

	for i in range(n):
		w_, v_ = map(int,input().split())
		w.append(w_)
		v.append(v_)

	nap_memo = {}
	def nap(i,j):
		key = str(i)+':'+str(j)

		if key in nap_memo:
			return nap_memo[key]

		r = 0
		if i == n:
			r = 0
		elif j < w[i]:
			r = nap(i+1,j)
		else:
			r = max(nap(i+1, j),
					nap(i+1, j-w[i]) + v[i])

		nap_memo[key] = r
		return r

	print(nap(0,w))


### FIXED CODE ###

# coding: utf-8

if __name__ == "__main__":
	n, w = map(int, input().split())
	vs, ws = [], []

	for i in range(n):
		w_, v_ = map(int, input().split())
		ws.append(w_)
		vs.append(v_)

	nap_memo = {}
	def nap(i, j):
		key = str(i)+':'+str(j)

		if key in nap_memo:
			return nap_memo[key]

		r = 0
		if i == n:
			r = 0
		elif j < ws[i]:
			r = nap(i+1, j)
		else:
			r = max(nap(i+1, j),
					nap(i+1, j-ws[i]) + vs[i])

		nap_memo[key] = r
		return r

	print(nap(0, w))
if S == "ABC":
    print("ARC")
else:
    print("ABC")

### FIXED CODE ###

S = input()

if S == "ABC":
    print("ARC")
else:
    print("ABC")
s = 'HAKUTYUMU' + input()


def check(s):
    next_s = s

    if s[-5:] == 'dream':
        next_s = s[:-5]
    if s[-7:] == 'dreamer':
        next_s = s[:-7]
    if s[-5:] == 'erase':
        next_s = s[:-5]
    if s[-6:] == 'eraser':
        next_s = s[:-6]

    if s == 'HAKUTYUMU':
        return True

    if s == next_s:
        return False

    return check(next_s)


if check(s):
    print('YES')
else:
    print('NO')


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000)

s = 'HAKUTYUMU' + input()


while s != 'HAKUTYUMU':
    next_s = s

    if s[-5:] == 'dream':
        next_s = s[:-5]
    if s[-7:] == 'dreamer':
        next_s = s[:-7]
    if s[-5:] == 'erase':
        next_s = s[:-5]
    if s[-6:] == 'eraser':
        next_s = s[:-6]

    if s == next_s:
        print('NO')
        exit()

    s = next_s

print('YES')
s=list(input())
l=[]
for i in s:
  if i=="B":
    if len(l)!=0:
      l.rstrip()
  elif i=="0":
    l.append(i)
  elif i=="1":
    l.append(i)
print("".join(l))


### FIXED CODE ###

s=list(input())
l=[]
for i in s:
    if i=="1":
        l.append(i)
    elif i=="0":
        l.append(i)
    elif i=="B":
        if len(l)!=0:
            l.pop()
print("".join(l))
from itertools import accumulate
S=list(map(len,input().split("T")))
x,y=map(int,input().split())
x=abs(x-S[0])
y=abs(y)
L=S[2::2]
R=S[1::2]
La=list(accumulate(L))
Ra=list(accumulate(R))
sumL=sum(L)
sumR=sum(R)
flag=0    
if sumL>=x and sumR>=y and (sumL-x)%2==0 and (sumR-y)%2==0 and flag==0:
    setL1={0}
    setR1={0}
    gL=(sumL-x)//2
    gR=(sumR-y)//2
    if gL==0:
        flag=1
    else:
        for i,cnt in enumerate(L):
            setL=setL1
            setL1=set()
            s=setL1.add
            h=sumL-La[cnt]
            for j in setL:
                k=i+j
                if k<gL and h+k>=gL:
                    s(k)
                if j<gL and h+j>=gL:
                    s(j)
                elif k==gL:
                    flag=1
                    break
            if flag==1:
                break
    if flag==1:
        if gR==0:
            flag=2
        else:
            for i in R:
                for j in setR:
                    setR=setR1
                    setR1=set()
                    s=setR1.add
                    h=sumR-Lb[cnt]
                    k=i+j
                    if k<gR and h+k>=gR:
                        s(k)
                    if j<gR and h+j>=gR:
                        s(j)
                    elif k==gR:
                        flag=2
                        break
                if flag==2:
                    break
if flag==2:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from itertools import accumulate
S=list(map(len,input().split("T")))
x,y=map(int,input().split())
x=abs(x-S[0])
y=abs(y)
L=S[2::2]
R=S[1::2]
La=list(accumulate(L))
Ra=list(accumulate(R))
sumL=sum(L)
sumR=sum(R)
flag=0
if sumL>=x and sumR>=y and (sumL-x)%2==0 and (sumR-y)%2==0 and flag==0:
    setL1={0}
    setR1={0}
    gL=(sumL-x)//2
    gR=(sumR-y)//2
    if gL==0:
        flag=1
    else:
        for cnt,i in enumerate(L):
            setL=setL1
            setL1=set()
            s=setL1.add
            h=sumL-La[cnt]
            for j in setL:
                k=i+j
                #if k<gL and h+k>=gL:
                s(k)
                #if j<gL and h+j>=gL:
                s(j)
                if k==gL:
                    flag=1
                    break
            if flag==1:
                break
    if flag==1:
        if gR==0:
            flag=2
        else:
            for cnt,i in enumerate(R):
                setR=setR1
                setR1=set()
                s=setR1.add
                h=sumR-Ra[cnt]
                for j in setR:
                    k=i+j
                    #if k<gR and h+k>=gR:
                    s(k)
                    #if j<gR and h+j>=gR:
                    s(j)
                    if k==gR:
                        flag=2
                        break
                if flag==2:
                    break
if flag==2:
    print("Yes")
else:
    print("No")
import sys
 
def main():
    S = input()
    l = len(S)
    
    cnt_l = []
    
    for i in range(l):
        cnt = 0
        for j in range(l-i):
            if str(S[i+j]) in ['A', 'C', 'G', 'T']:
                cnt += 1
            else:
                cnt_l.append(cnt)
 
    out = max(cnt_l)
 
    print(out)
main()

### FIXED CODE ###

import sys

def main():
    S = input()
    l = len(S)
    
    ans = 0
    for i in range(l):
        for j in range(i, l):
            if all(['ATGC'.count(c) == 1 for c in S[i:j+1]]):
                ans = max(ans, j-i+1)
            
    print(ans)
main()
a,b,c=map(int,input().split())

if a==b:
  if b==c:
    print("No")
  else:
    printf("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

a,b,c = input().strip().split()

if a==b:
  if b==c:
    print("No")
  else:
    print("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")
A, B, K = map(int, input().split())
res = set(list(range(A,B+1))) &\
     (set([i for i in range(A, A+K)]) | set([i for i in range(B-K+1, B+1)]))
print(*sorted(res), sep="\n")

### FIXED CODE ###

A, B, K = map(int, input().split())
res = (set([i for i in range(A, A+K) if A<=i<=B]) |\
       set([i for i in range(B-K+1, B+1) if A<=i<=B]))
print(*sorted(res), sep="\n")
def dfs(curr, path, N, edges, visited):
    visited[curr] = True
    path.append(curr)
    for dst in edges[curr]:
        if not visited[dst]:
            return dfs(dst, path, N, edges, visited)
    return path

N,M=map(int,input().split())
edges=[[] for _ in range(N)]
for _ in range(M):
    A,B=map(int,input().split())
    edges[A-1].append(B-1)
    edges[B-1].append(A-1)
visited=[False]*N
path1 = dfs(0,[],N,edges,visited)
path2 = dfs(0,[],N,edges,visited)
path = path2[::-1] + path1[1:]
print(" ".join([str(v+1) for v in path]))


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N,M=map(int,input().split())
edges=[[] for _ in range(N)]
for _ in range(M):
    A,B=map(int,input().split())
    edges[A-1].append(B-1)
    edges[B-1].append(A-1)

visited=[False]*N
path=[]

def dfs(curr):
    visited[curr] = True
    path.append(curr)
    for dst in edges[curr]:
        if not visited[dst]:
            dfs(dst)
            return

dfs(0)
path=path[1:][::-1]
dfs(0)

print(len(path))
print(" ".join([str(v+1) for v in path]))
S = input()
s = S[0]
ans = 0
def dfs(n,S,s):
    global ans
    s_0 = s + "+" + S[n]
    s_1 = s + S[n]
    if n == len(S) - 1:
        ans += eval(s_0) + eval(s_1)
    else:
        dfs(n+1,S,s_0)
        dfs(n+1,S,s_1)
dfs(1,S,s)
print(ans)

### FIXED CODE ###

S = input()
s = S[0]
ans = 0
def dfs(n,S,s):
    global ans
    s_0 = s + "+" + S[n]
    s_1 = s + S[n]
    if n == len(S) - 1:
        ans += eval(s_0) + eval(s_1)
    else:
        dfs(n+1,S,s_0)
        dfs(n+1,S,s_1)
if len(S) == 1:
    print(int(S))
else:
    dfs(1,S,s)
    print(ans)
buf=''
cnt = 1
total = 0
cnts = []


for s in S:
    #print(buf,s,cnt)
    if s == buf:
        cnt += 1       
    else:
        cnts.append(cnt)
        total += int(cnt/2)
        cnt = 1        
    buf = s
cnts.append(cnt)    
total += int(cnt/2)

if S[0]==S[-1]:
    if (cnts[1]+cnts[-1]) % 2 == 0:
        print(total*K+K-1)
else:
    print(total*K)

### FIXED CODE ###

from itertools import groupby
S = input()
K = int(input())
a = [len(tuple(s)) for _, s in groupby(S)]
ans = 0
 
if S[0] == S[-1] and K > 1:
    if len(a) == 1:
        ans = a[0]*K // 2
    else:
        ans = a[0] // 2 + a[-1] // 2 + (a[0]+a[-1]) // 2 * (K-1)
        ans += sum(n // 2 for n in a[1:-1]) * K
else:
    ans = sum(n // 2 for n in a) * K
print(ans)
def p_c():
    W, H, x, y = map(int, input().split())
    is0 = W / 2 == x ^ H / 2 == y
    print(W * H / 2, 0 if is0 else 1)
    
p_c()

### FIXED CODE ###

def p_c():
    W, H, x, y = map(int, input().split())
    is1 = (W / 2 == x) and (H / 2 == y)
    print(W * H / 2, 1 if is1 else 0)
    
p_c()
data = input().split()

if data[1] = "+":
    print int(data[0] + data[2])
else
    print int(data[0] - data[2])

### FIXED CODE ###

data = input().split()

if data[1] in "+":
    print(int(data[0]) + int(data[2]))
else:
    print(int(data[0]) - int(data[2]))
n = int(input())
multi = list(map(int,input().split()))
result = 1 

for i in range(n):
    result = result * multi[i]
    if (result > 10**18):
        ans = -1
        exit()
        
print(result)

### FIXED CODE ###

a, b = map(int,input().split())
print(a*b)
s = list(input())
n = (len(s)+1)//2
m = n//2
  if s[:n-1] == s[len(s):n-1:-1] and s[:m-1] == s[n-2:m-1:-1]:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

s = list(input())
n = (len(s)+1)//2
if s[:n-1] == s[len(s):n-1:-1] == s[n-2::-1]:
  print("Yes")
else:
  print("No")