Harryxun/stf_run huggingface dataset:
N, K = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))
scores = []
for i in range(N):
  pos = P[i]-1
  s = [C[i]]
  j = 1
  while j < K and pos != i:
    s.append(s[-1]+C[pos])
    pos = P[pos]-1
    j += 1
  smax = max(s)
  length = len(s)
  if length < K and s[-1] > 0:
    smod = s[:K%length]
    smodmax = max(smod)
    if smax == smodmax:
      scores.append(s[length-1] * (K//length) + smax)
    else:
      scores.append(max(s[length-1] * ((K//length)-1) + smax, s[length-1] * (K//length), s[length-1] * (K//length) + smodmax))
  else:
    scores.append(smax)
print(max(scores))

### FIXED CODE ###

N, K = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))
scores = []
for i in range(N):
  pos = P[i]-1
  s = [C[i]]
  j = 1
  while j < K and pos != i:
    s.append(s[-1]+C[pos])
    pos = P[pos]-1
    j += 1
  smax = max(s)
  length = len(s)
  if length < K and s[-1] > 0:
    if K%length != 0:
      smod = s[:K%length]
      smodmax = max(smod)
    else:
      smodmax = 0
    scores.append(max(s[-1] * ((K//length)-1) + smax, s[-1] * (K//length), s[-1] * (K//length) + smodmax))
  else:
    scores.append(smax)
print(max(scores))
n=int(input())???
for i in range(n)
        s=input().split(" ")
        s=[int(j) for j in s]
        s.sort()
        
        if(s[0]**2+s[1]**2==s[2]**2):
            print("YES")

        else:
            print("NO")
        

  

### FIXED CODE ###

n=int(input())
for i in range(n):
        s=input().split(" ")
        s=[int(j) for j in s]
        s.sort()
        
        if(s[0]**2+s[1]**2==s[2]**2):
            print("YES")

        else:
            print("NO")
N=int(input())
A=[]
pairs=[]
for i in range(N):
    a=int(input())
    A.append(a)
    pair=[]
    for j in range(a):
        x,y=map(int,input().split())
        pair.append([x-1,y])
    pairs.append(pair)

def judge(bit):
    for i in range(N):
        if bit&(1<<i)==False: #決め打ち時に不親切の場合
            continue
        for j in range(A[i]): #親切な人の発言検証
            tmpx=pairs[j][0][0]
            tmpy=pairs[j][0][1]
            if tmpy==1  and (bit&(1<<tmpx)==False):
                return False
            elif tmpy==0 and (bit&(1<<tmpx)):
                return False
    return True

ans=0
for bit in range((1<<N)):
    if judge(bit):
        count=0
        for i in range(N):
            if bit&(1<<i):
               count+=1
        ans=max(ans,count)

print(ans)

### FIXED CODE ###

N=int(input())
A=[]
pairs=[]
for i in range(N):
    a=int(input())
    A.append(a)
    pair=[]
    for j in range(a):
        x,y=map(int,input().split())
        pair.append([x-1,y])
    pairs.append(pair)

def judge(bit):
    for i in range(N):
        if bit&(1<<i)==False: #決め打ち時に不親切の場合
            continue
        for j in range(A[i]): #親切な人の発言検証
            tmpx=pairs[i][j][0]
            tmpy=pairs[i][j][1]
            if tmpy==1  and (bit&(1<<tmpx)==False):
                return False
            if tmpy==0 and (bit&(1<<tmpx)):
                return False
    return True

ans=0
for bit in range((1<<N)):
    if judge(bit):
        count=0
        for i in range(N):
            if (bit&(1<<i)):
               count+=1
        ans=max(ans,count)

print(ans)
k, x = map(int, input().split())

if k*500 >= x:
    print('Yes')
else:
    print('No'

### FIXED CODE ###

k, x = map(int, input().split())

if k*500 >= x:
    print('Yes')
else:
    print('No')
X=int(input())
trial=0
p=100
while p<=x:
  trial+=1
  p=p*1.01
print(trial)

### FIXED CODE ###

import math

x=int(input())
trial=0
p=100
while p<x:
  trial+=1
  p=p*1.01
  p=math.floor(p)
print(trial)
i= int(input())
s = input()
en = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
s_list = [(en[(en.index(k)+i)%26]) for k in s]
print(''.join(s_list)

### FIXED CODE ###

i= int(input())
s = input()
en = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
s_list = [(en[(en.index(k)+i)%26]) for k in s]
print(''.join(s_list))
a=int(input())  
b=int(input())  
s=a*b       
print(s)


### FIXED CODE ###

s = raw_input().split()
a = int(s[0])
b = int(s[1])
print("{0} {1}".format(a*b, 2*(a+b)))
import math
import sys
input = sys.stdin.readline

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


lcm=[0]*(10**3+5)



for i in range(N):
    a=A[i]
    b=int(math.sqrt(a))+1
    for j in range(2,b):
        temp=0
        while a%j==0:
            a=a//j
            temp+=1
        lcm[j]=max(lcm[j],temp)
    if a!=1:
        lcm[a]+=1
                
        
l=1
for j in range(2,len(lcm)):
    l*=pow(j,lcm[j])
    

ans=0
mod=10**9+7

for i in range(N):
    ans+=l//A[i]
    ans%=mod
    
print(ans%mod)

### FIXED CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
lcm = defaultdict(int)


for i in range(N):
    a=A[i]
    for j in range(2,a):
        temp=0
        while a%j==0:
            a=a//j
            temp+=1
        lcm[j]=max(lcm[j],temp)
        if a==1 or j*j>A[i]:
            break
    if a!=1:
        lcm[a]=max(lcm[a],1)
                
        
l=1
for d in lcm.items():
    l*=pow(d[0],d[1])
    

ans=0
mod=10**9+7

for i in range(N):
    ans+=l//A[i]
    
print(ans%mod)
N = int(input())
h = list(map(int, input().split()))
memo = [-1]*N
def dp(i):
    if memo[i]>=0:
        return memo[i]
    if i == 0:
        memo[i] = 0
        return 0
    if i>=2:
        memo[i] = min(dp(i-1)+abs(h[i]-h[i-1]), dp(i-2)+abs(h[i]-h[i-2]))
    else:
        memo[i] = dp(i-1)+abs(h[i]-h[i-1])
    return memo[i]
print(dp(N-1))



### FIXED CODE ###

N = int(input())
h = list(map(int, input().split()))
dp = [0]*N
for i in range(1, N):
    if i-2>=0:
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
    else:
        dp[i] = dp[i-1]+abs(h[i]-h[i-1])
print(dp[-1])
while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f ==r -1:
        break

    if m + f  <= 80:
        print('A')

    elif m + f == 60 < m + f ==80:
        print('B')

    elif m + f == 50 < m + f ==65:
        print('C')

    if m + f == 30 < m + f ==50:
        print('D')

    elif r <= 50:
        print('C')

    else:
        print('F')

### FIXED CODE ###

while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')
        
    elif total < 80:
        print('B')

    else:
        print('A')
a,b,k=map(int,input().split())
if a>=k:
  a1=a-k
  print(a1,b)
else:
  a1=0
  if b>=k-a:
    b1=b-(k-a)
  else:
    b1=0
  print(a1,b1)


### FIXED CODE ###

s,t=input().split()
print(t+s)
n =map(int,input().split())
ans=0
for i in range(n):
  if i*i <= n:
    ans =i
print(ans)

### FIXED CODE ###

n=(int)(input())
ans =1
for i in range(n):
  for j in range(n):
    p=j+2
    if i**p <=n:
      ans=max(ans,i**p)
    else:
      break
print(ans)
N = int(input())
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]
flag = 0
count = 0

for i in range(N-1):
  if x[i] == y[i]:
    count += 1
    if count >= 3:
      flag = 1
  else:
    count = 0
  

if flag == 1:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
flag = 0
count = 0

for i in range(N):
  if x[i] == y[i]:
    count += 1
    if count >= 3:
      flag = 1
  else:
    count = 0

if flag == 1:
  print('Yes')
else:
  print('No')
N = int(input())

return N^3

### FIXED CODE ###

N = int(input())

print(N**3)
import sys

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

if(A.index(0) >= 0):
    print(0)
    sys.exit(0)

prod = 1
for a in A:
    prod *= a
    if prod > 1000000000000000000:
        print(-1)
        sys.exit(0)

print(prod)

### FIXED CODE ###

import sys

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

if(0 in A):
    print(0)
    sys.exit(0)

prod = 1
for a in A:
    prod *= a
    if prod > 1000000000000000000:
        print(-1)
        sys.exit(0)

print(prod)
n = raw_input()
a = map(int, raw_input().split())
  
for i in range(0, n):
   print a(n-i-1),

### FIXED CODE ###

n = input()
a = map(int, raw_input().split())
    
for i in range(0, n):
   print a[n-i-1],
N = int(input())
lst_a = [int(input()) for _ in range(N)]
lst_ans = [0] * (10**5 + 2)
lst_a.sort()


for a in lst_a:
    lst_ans[a] += 1
ans = sum(1 for i in lst_ans if i % 2 != 0)


print(ans)

### FIXED CODE ###

from collections import Counter


N = int(input())
lst_number = [int(input()) for _ in range(N)]
set_number = set(lst_number)
cnt_number = Counter(lst_number)
ans = 0


for key in set_number:
    if cnt_number[key] % 2 == 1:
        ans += 1


print(ans)
N,K=map(int, input().split())
s=[]
for i in range(K):
    d=int(input())
    for j in range(d):
        s+=[int(input())]
s=set(s)
#print(s)
s=list(s)
#print(s)
s.sort()
#print(s)
print(N-len(s))

### FIXED CODE ###

N,K=map(int, input().split())
s=[]
for i in range(K):
    d=int(input())
    a=list(map(int, input().split()))
    for j in range(len(a)):
        s+=[a[j]]
s=set(s)
#print(s)
s=list(s)
#print(s)
s.sort()
#print(s)
print(N-len(s))
n = int(input())
z = [[map(int, input().split())] for i in range(n)]
m = 0
d = 0
for i in range(n-1):
  for j in range(i+1, n):
    d = 0
    d += max(z[i][0] - z[j][0], z[j][0] - z[i][0])
    d += max(z[i][1] - z[j][1], z[j][1] - z[i][1])
    if d>m:
      m = d
print(m)
	

### FIXED CODE ###

n = int(input())
u = [list(map(int, input().split())) for i in range(n)]
z = [u[i][0] + u[i][1] for i in range(n)]
w = [u[i][0] - u[i][1] for i in range(n)]
d = [max(z)-min(z), max(w)-min(w)]

print(max(d))
from bisect import bisect

s = input()
t = input()

if len(set(t) & set(s)) != len(set(t)):
    print(-1)
    exit()

d = dict()

for i, si in enumerate(s):
    if si in d:
        d[si].append(i)
    else:
        d[si] = [i]

ans = 0
res = d[t[0]][0]

for i in range(1, len(t)):
    index = bisect(d[t[i]], res)
    if index == len(d[t[i]]):
        ans += len(s)
        res = d[t[i]][0]
    else:
        res = d[t[i]][index]

if index == len(d[t[-1]]):
    ans += d[t[i]][0] + 1
else:
    ans += d[t[i]][index] + 1

print(ans)

### FIXED CODE ###

from bisect import bisect

s = input()
t = input()

d = dict()

for i in range(26):
    d[chr(i+97)] = []

for i, si in enumerate(s):
    d[si].append(i)

ans = 0
res = -1

for i in range(len(t)):
    if d[t[i]] == []:
        print(-1)
        exit()
    index = bisect(d[t[i]], res)
    if index == len(d[t[i]]):
        ans += len(s) - res + d[t[i]][0]
        res = d[t[i]][0]
    else:
        ans += d[t[i]][index] - res
        res = d[t[i]][index]

print(ans)
N = int(input())
T = [int(input()) for i in range(N)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


if N == 1:
    print(T[0])
    exit()

now = lcm(T[0], T[1])
for i in range(1, N):
    now = lcm(now, T[i])

print(now)


### FIXED CODE ###

N = str(input())
if N == N[::-1]:
    print('Yes')
else:
    print('No')
import collections 
while 1:
    n,m= list(map(int,input().split(' ')))
    if n ==m ==0:break
    D = collections.deque()
    for _ in range(n):
        d_i,p_i = list(map(int,input().split(' ')))
        D.append((d_i,p_i))
    sorted(D,key = lambda x:x[0])
    while m > 0:
        temp = D.popleft()
        if temp[0] > m:
            temp = (temp[0] - m,temp[1])
            m=0
        else: 
            m -= temp[0]
            temp = (0,temp[1])
        D.append(temp)
    ans = 0
    for i in D:
        ans += i[0]*i[1]
    print(ans)


### FIXED CODE ###

while 1:
    n,m= list(map(int,input().split(' ')))
    if n == m ==0:break
    D = []
    for _ in range(n):
        d_i,p_i = list(map(int,input().split(' ')))
        D.append((d_i,p_i))
    D = sorted(D,key = lambda x:x[1],reverse = True)
    while m > 0:
        if len(D) ==0:break
        temp = D.pop(0)
        if temp[0] > m:
            temp = (temp[0] - m,temp[1])
            m=0
            D.append(temp)
        else: 
            m -= temp[0]      
    ans = 0
    for i in D:
        ans += i[0]*i[1]
    print(ans)
def is_prime(n):
    if n == 2 or n == 3: return True
    if n < 2 or n%2 == 0: return False
    if n < 9: return True
    if n%3 == 0: return False
    r = int(n**0.5)
    f = 5
    while f <= r:
        print '\t',f
        if n%f == 0: return False
        if n%(f+2) == 0: return False
        f +=6
        return True  

def divisor(a,b):
    tab = [1]
    for i in range (2, min(a,b)):
        if (a%i == 0 and b%i == 0):
            tab.append(i)
    return tab

def separatePrime(tab):
    pr = []
    npr = []
    for i in tab:
        if (is_prime(i) or i == 1):
            pr.append(i)
        else:
            npr.append(i)
    return pr, npr

def finish(pr, npr):
    for i in npr:
        can = True
        j = 1
        while (can and j < len(pr)):
            if (i%pr[j] == 0):
                can = False
            j += 1
        if (can):
            pr.append(i)
    
    return (len(pr))

data = raw_input().split()
a,b = int(data[0]), int(data[1])
tab = divisor(a,b)

pr,npr = separatePrime(tab)

print finish(pr, npr)

### FIXED CODE ###

a = int(raw_input())

if (a%2 == 0):
    print(0.5)
else:
    odd = (a // 2) + 1
    odd = float(odd)
    print (float(odd/a))
from itertools import accumulate
from math import sqrt
from bisect import bisect_left

N = int(input())
n = list(accumulate(range(int(sqrt(N)) + 5)))

r = bisect_left(n, N)

if n[r] == N:
    print('\n'.join(map(str, range(1, r + 1))))
    exit()

d = n[r] - N
for i in range(1, r + 1):
    if i != d:
        print(i)

### FIXED CODE ###

from itertools import accumulate
from math import sqrt
from bisect import bisect_left

N = int(input())
n = list(accumulate(range(int(sqrt(2 * N)) + 2)))

r = bisect_left(n, N)

if n[r] == N:
    print('\n'.join(map(str, range(1, r + 1))))
    exit()

d = n[r] - N
for i in range(1, r + 1):
    if i != d:
        print(i)
import functools
import math

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

# 最大公約数
ans = functools.reduce(math.gcd, a)
print(ans)

### FIXED CODE ###

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

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

element = gcd(a[0], a[1])
if n==2:print(element)
else:
    for i in range(2,n):
        element=gcd(element,a[i])
    print(element)
import sys
sys.setrecursionlimit(10**6)

n = int(input())
x = input()
xi = int('0b' + x, 2)
xc = x.count("1")

xip = xi % (xc+1)
xim = xi % (xc-1)

def f(u):
  if u==0: return 0
  m = u % bin(u).count("1")
  return 1 + f(m)

for i in range(n):
  if x[i] == "0":
    # y = xip + (pow(2, n-i-1, )%(xc+1))
    y = xip + pow(2, n-i-1, xc+1)
    y = y % (xc+1)
  else:
    # y = xim - (pow(2, n-i-1)%(xc-1))
    y = xim - pow(2, n-i-1, xc-1)
    y = y % (xc-1)

  print(f(y)+1)


### FIXED CODE ###

N = int(input())
X = input()
val = int(X,2)
C = X.count("1")

if C==1:
  for i in range(N):
    if X[i]=='1':
      print(0)
    elif i==N-1:
      print(2)
    else:
      print(1)
  exit()

# xをpopcountで割ったあまりに置き換える
def f(x):
  if x==0: return 0
  return 1 + f(x % bin(x).count("1"))

# 初回のpopcountでの割り方は、(C+1) or (C-1)
Y = val%(C+1)
if C-1 != 0:
  Z = val%(C-1)
else:
  Z = 0

for i in range(N):
  if X[i] == "1":
    if Z - 1 == 0:
      print(0)
      continue
    k = (Z - pow(2,N-i-1,C-1)) % (C-1)
  else:
    k = (Y + pow(2,N-i-1,C+1)) % (C+1)
  print(f(k)+1)
s = input(str())
print(s.text("1"))

### FIXED CODE ###

s = input(str())
print(s.count("1"))
if N%2 == 0:
  print(int(N/2))
else:
  print(int(N+1/2))

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))
H, W = map(int, input().split())
A = [input() for _ in range(H)]
pos = {x:0, y:0}
cnt = 0
for i in range(H):
  cnt += A[i].count('#')

if cnt == (H + W -1):
  print("Possible")
else:
  print("Impossible")

### FIXED CODE ###

H, W = map(int, input().split())
A = [input() for _ in range(H)]
cnt = 0
for i in range(H):
  cnt += A[i].count('#')

if cnt == (H + W -1):
  print("Possible")
else:
  print("Impossible")
from collections import deque
N = input()
A = []
for i in range(N):
	a = input()
	A.append(a)

A = sorted(A)
res = []
begin = 0
end = len(A) - 1
res = deque()
res.append(A[begin])
res.append(A[end])
begin+= 1
end -= 1
for i in range(N - 2):
	l = [abs(res[0] - A[begin]), abs(res[0] - A[end]), abs(res[-1] - A[begin]), abs(res[-1] - A[end])]
	cand = l.list(max(l))
	if cand == 0:
		res.appendleft(A[begin])
		begin += 1
	elif cand == 1:
		res.appendleft(A[end])
		end -= 1
	elif cand == 2:
		res.append(A[begin])
		begin += 1
	elif cand == 3:
		res.append(A[end])
		end -= 1
sum_diff = 0
for i in range(N - 1):
	 sum_diff += abs(res[i] - res[i + 1])
print sum_diff


### FIXED CODE ###

from collections import deque
N = input()
A = [int(input()) for i in range(N)]
coef = [2] * N
coef[0] = 1
coef[-1] = 1
coef1 = [coef[i] if i % 2 == 0 else coef[i] * -1 for i in range(N)]
coef2 = [coef[i] if i % 2 != 0 else coef[i] * -1 for i in range(N)]

A = sorted(A)
coef1 = sorted(coef1)
coef2 = sorted(coef2)
res1 = 0
for i in range(N):
	res1 += A[i] * coef1[i]
res2 = 0
for i in range(N):
	res2 += A[i] * coef2[i]
print max(res1, res2)
abcd=int(input().split())
a=abcd[0]
b=abcd[1]
c=abcd[2]
d=abcd[3]
if a+b==c+d:
  print('Balanced')
else:
    if a+b>c+d:
      print('Left')
    else:
        print('Right')
        

### FIXED CODE ###

abcd=input().split()
a=int(abcd[0])
b=int(abcd[1])
c=int(abcd[2])
d=int(abcd[3])
if a+b==c+d:
  print('Balanced')
else:
    if a+b>c+d:
      print('Left')
    else:
        print('Right')
N = input()
a = []
for i in range(N):
    a.append(map(int, raw_input().split())
for i in range(N):
    a = a[i][0] ** 2
    b = a[i][1] ** 2
    c = a[i][2] ** 2

    if a == b + c or b == a + c or c == a + b:
        print "YES"
    else:
        print "NO"

### FIXED CODE ###

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

for j in range(N):

    x = a[j][0] ** 2
    y = a[j][1] ** 2
    z = a[j][2] ** 2

    if x == y + z:
        print "YES"
    elif y == x + z:
        print "YES"
    elif z == x + y:
        print "YES"
    else:
        print "NO"
n = int(input())
s = input().split()

if Y in s:
  print('Four')
else:
  print('Three')

### FIXED CODE ###

n = int(input())
s = input().split()
 
if 'Y' in s:
  print('Four')
else:
  print('Three')
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    str_sum = sum([map(int, input().split())])
    if str_sum == 17:
        print('YES')
    else:
        print('NO')


### FIXED CODE ###

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

if __name__ == "__main__":
    # str_list = [map(int, input().split())]
    # if str_list.count(5) == 2 and str_list.count(7) == 1:
    #     print('YES')
    # else:
    #     print('NO')
    str_list = list(map(int, input().split()))
    if sum(str_list) == 17:
        print('YES')
    else:
        print('NO')
import sys
s=input()
l=len(s)
for i in range(0,l,2):
  if s[i]=='h':
    if s[i+1]!='i':
      print('No')
      sys.exit()
  else:
    print('No')
    sys.exit()
print('Yes')

### FIXED CODE ###

import sys
s=input()
l=len(s)
if l%2==1:
  print('No')
  sys.exit()
for i in range(0,l,2):
  if s[i]=='h':
    if s[i+1]!='i':
      print('No')
      sys.exit()
  else:
    print('No')
    sys.exit()
print('Yes')
a = list(map(str, input().split()))
b = list(map(str, input().split()))
if a[0] == b[2] and a[1] == b[1] and a[2] == b[0]:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

a = input()
b = input()
if a[0] == b[2] and a[1] == b[1] and a[2] == b[0]:
    print("YES")
else:
    print("NO")
N = int(input())
D = sorted(list(map(int,input().split())))

ans = 1
count = {}
for i in range(N):
  if i < D[i] or (i > 0 and D[i] == 0):
    print(0)
    exit()
  else:
    if D[i] in count:
      count[D[i]] += 1
    else:
      count[D[i]] = 1
    if D[i] > 0:
      ans *= count[D[i]-1]
print(ans)

### FIXED CODE ###

N = int(input())
D = list(map(int,input().split()))
MOD = 998244353

if D[0] != 0:
  print(0)
  exit()

D.sort()
ans = 1
count = {}
for i in range(N):
  if i > 0:
    if D[i]-1 in count:
      ans *= count[D[i]-1]
      ans %= MOD
    else:
      print(0)
      exit()
  if D[i] in count:
    count[D[i]] += 1
  else:
    count[D[i]] = 1
print(ans)
n,k= map(int,input().split())
s = input()

s = [val for val in s]

s[k]=s[k].lower()

print("".join(s))


### FIXED CODE ###

n,k= map(int,input().split())
s = input()

s = [val for val in s]

s[k-1]=s[k-1].lower()

print("".join(s))
array = [int(i) for i in list(input())]
flag = False
fugou = ['+', '-']

for i in fugou:
	if i == '+':
		tmp = array[0] + array[1]
	else:
		tmp = array[0] - array[1]
	for j in fugou:
		if j == '+':
			tmp2 = tmp + array[2]
		else:
			tmp2 = tmp - array[2]
		for k in fugou:
			if k == '+':
				if tmp2 + array[3] == 7:
					print(str(array[0])
							+ i + str(array[1])
							+ j + str(array[2])
							+ k + str(array[3]))
							+ '=7')
					flag = True
					break
			else:
				if tmp2 - array[3] == 7:
					print(str(array[0])
							+ i + str(array[1])
							+ j + str(array[2])
							+ k + str(array[3])
							+ '=7')
					flag = True
					break
		if flag: break
	if flag: break

### FIXED CODE ###

array = [int(i) for i in list(input())]
flag = False
fugou = ['+', '-']

for i in fugou:
	if i == '+':
		tmp = array[0] + array[1]
	else:
		tmp = array[0] - array[1]
	for j in fugou:
		if j == '+':
			tmp2 = tmp + array[2]
		else:
			tmp2 = tmp - array[2]
		for k in fugou:
			if k == '+':
				if tmp2 + array[3] == 7:
					print(str(array[0])
							+ i + str(array[1])
							+ j + str(array[2])
							+ k + str(array[3])
							+ '=7')
					flag = True
					break
			else:
				if tmp2 - array[3] == 7:
					print(str(array[0])
							+ i + str(array[1])
							+ j + str(array[2])
							+ k + str(array[3])
							+ '=7')
					flag = True
					break
		if flag: break
	if flag: break
# ABC125B

n = int(input())
x = 0
y = 0
for i in range(n):
    v, c = map(int, input().split())
    if v > c:
        x += v
        y += c
print(abs(x - y))


### FIXED CODE ###

# ABC125B

n = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
x = 0
y = 0
for v, c in zip(V, C):
    if v > c:
        x += v
        y += c
print(abs(x - y))
import math
import heapq
import sys
from collections import Counter

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N,x=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
a=list(map(int,input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

heapq.heapify(a)  # リストを優先度付きキューへ

for i in range(N):
    x-=heapq.heappop(a)  # 最小値の取り出し
    #print(x,a)
    if x<=0 or i==N-1:
        print(i+1)
        break

### FIXED CODE ###

import math
import heapq
import sys
from collections import Counter

#N,K=map(int, input[0].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[1].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

N,x=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
a=list(map(int,input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

heapq.heapify(a)  # リストを優先度付きキューへ

for i in range(N):
    x-=heapq.heappop(a)  # 最小値の取り出し
    #print(x,a)
    if x<=0 or i==N-1:
        if x==0:
            print(i+1)
        else:
            print(i)
        break
line = input().split(' ')
a = line[0]
b = line[1]

print(a*b 2*(a+b))

### FIXED CODE ###

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

print(a*b, 2*(a+b))