def main():
    examC()

def examA():
    S = SI()
    S = ">" + S + "<"
    N = len(S)
    A = [0]*N
    i = 0
    while(i<N-1):
        r = i + 1
        if S[i]==">" and S[i+1]=="<":
            A[i] = 0
            l = i-1
            cur = 0
            while(1<=l):
                cur += 1
                A[l] = max(A[l], cur)
                l -= 1
                if S[l+1]=="<":
                    #print("break",l,A)
                    break
            r = i+1
            cur = 0
            while(r<N-1):
                cur += 1
                A[r] = max(A[r], cur)
                r += 1
                if r==N-1:
                    break
                if S[r]==">":
                    break
        #print(i,A)
        i = r
    #print(A)
    A[0] = 0; A[-1] = 0
    ans = sum(A)
    print(ans)
    return

def examB():
    H, W = LI()
    A = [SI()for _ in range(H)]
    C = defaultdict(int)
    for a in A:
        for s in a:
            C[s] += 1
    B = sorted(C.items())
    # print(B)
    flag_odd = not (H%2==1 and W%2==1)
    upper_2 = (H%2==1) * (W//2) + (W%2==1) * (H//2)
    for s,c in B:
        if c%2==1:
            if flag_odd:
                print("No")
                return
            flag_odd = True
        elif c%4==2:
            upper_2 -= 1
            if upper_2<0:
                print("No")
                return
    print("Yes")
    return

def examC():
    N, K = LI()
    P = LI()
    C = LI()

    if max(C)<0:
        print(max(C))
        return

    loop = [[0,0]for _ in range(N)]

    for i in range(N):
        checked = set()
        now = i
        score = 0
        while(now not in checked):
            checked.add(now)
            now = P[now]-1
            score += C[now]
        n = len(checked)
        for j in checked:
            loop[j] = [n,score]
    # print(loop)
    ans = 0
    for i in range(N):
        n,s = loop[i]
        score = 0
        if s>0:
            score += (K//n - 1) * s
        ans = max(ans,score)
        now = i
        for j in range(n + K%n):
            now = P[now] - 1
            score += C[now]
            ans = max(ans,score)

    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,alphabet_convert,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<31
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    main()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
""" def main():
    examC() main examC() examC def examA():
    S = SI()
    S = ">" + S + "<"
    N = len(S)
    A = [0]*N
    i = 0
    while(i<N-1):
        r = i + 1
        if S[i]==">" and S[i+1]=="<":
            A[i] = 0
            l = i-1
            cur = 0
            while(1<=l):
                cur += 1
                A[l] = max(A[l], cur)
                l -= 1
                if S[l+1]=="<":
                    #print("break",l,A)
                    break
            r = i+1
            cur = 0
            while(r<N-1):
                cur += 1
                A[r] = max(A[r], cur)
                r += 1
                if r==N-1:
                    break
                if S[r]==">":
                    break
        #print(i,A)
        i = r
    #print(A)
    A[0] = 0; A[-1] = 0
    ans = sum(A)
    print(ans)
    return examA S = SI() S SI() SI S = ">" + S + "<" S ">" + S + "<" ">" + S ">" S "<" N = len(S) N len(S) len S A = [0]*N A [0]*N [0] 0 N i = 0 i 0 while(i<N-1):
        r = i + 1
        if S[i]==">" and S[i+1]=="<":
            A[i] = 0
            l = i-1
            cur = 0
            while(1<=l):
                cur += 1
                A[l] = max(A[l], cur)
                l -= 1
                if S[l+1]=="<":
                    #print("break",l,A)
                    break
            r = i+1
            cur = 0
            while(r<N-1):
                cur += 1
                A[r] = max(A[r], cur)
                r += 1
                if r==N-1:
                    break
                if S[r]==">":
                    break
        #print(i,A)
        i = r
    #print(A)
     i<N-1 i N-1 N 1 r = i + 1 r i + 1 i 1 if S[i]==">" and S[i+1]=="<":
            A[i] = 0
            l = i-1
            cur = 0
            while(1<=l):
                cur += 1
                A[l] = max(A[l], cur)
                l -= 1
                if S[l+1]=="<":
                    #print("break",l,A)
                    break
            r = i+1
            cur = 0
            while(r<N-1):
                cur += 1
                A[r] = max(A[r], cur)
                r += 1
                if r==N-1:
                    break
                if S[r]==">":
                    break
        #print(i,A)
         S[i]==">" and S[i+1]=="<" S[i]==">" S[i] S i ">" S[i+1]=="<" S[i+1] S i+1 i 1 "<" A[i] = 0 A[i] A i 0 l = i-1 l i-1 i 1 cur = 0 cur 0 while(1<=l):
                cur += 1
                A[l] = max(A[l], cur)
                l -= 1
                if S[l+1]=="<":
                    #print("break",l,A)
                    break
             1<=l 1 l cur += 1 cur 1 A[l] = max(A[l], cur) A[l] A l max(A[l], cur) max A[l] A l cur l -= 1 l 1 if S[l+1]=="<":
                    #print("break",l,A)
                    break
             S[l+1]=="<" S[l+1] S l+1 l 1 "<" break r = i+1 r i+1 i 1 cur = 0 cur 0 while(r<N-1):
                cur += 1
                A[r] = max(A[r], cur)
                r += 1
                if r==N-1:
                    break
                if S[r]==">":
                    break
        #print(i,A)
         r<N-1 r N-1 N 1 cur += 1 cur 1 A[r] = max(A[r], cur) A[r] A r max(A[r], cur) max A[r] A r cur r += 1 r 1 if r==N-1:
                    break
                 r==N-1 r N-1 N 1 break if S[r]==">":
                    break
        #print(i,A)
         S[r]==">" S[r] S r ">" break i = r i r A[0] = 0 A[0] A 0 0 A[-1] = 0 A[-1] A -1 0 ans = sum(A) ans sum(A) sum A print(ans) print ans return def examB():
    H, W = LI()
    A = [SI()for _ in range(H)]
    C = defaultdict(int)
    for a in A:
        for s in a:
            C[s] += 1
    B = sorted(C.items())
    # print(B)
    flag_odd = not (H%2==1 and W%2==1)
    upper_2 = (H%2==1) * (W//2) + (W%2==1) * (H//2)
    for s,c in B:
        if c%2==1:
            if flag_odd:
                print("No")
                return
            flag_odd = True
        elif c%4==2:
            upper_2 -= 1
            if upper_2<0:
                print("No")
                return
    print("Yes")
    return examB H, W = LI() H LI() LI W SI()for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) SI() SI A = [SI()for _ in range(H)] A [SI()for _ in range(H)] C = defaultdict(int) C defaultdict(int) defaultdict int for a in A:
        for s in a:
            C[s] += 1
     a A for s in a:
            C[s] += 1
     s a C[s] += 1 C[s] C s 1 B = sorted(C.items()) B sorted(C.items()) sorted C.items() C.items C items flag_odd = not (H%2==1 and W%2==1) flag_odd not (H%2==1 and W%2==1) H%2==1 and W%2==1 H%2==1 H%2 H 2 1 W%2==1 W%2 W 2 1 upper_2 = (H%2==1) * (W//2) + (W%2==1) * (H//2) upper_2 (H%2==1) * (W//2) + (W%2==1) * (H//2) (H%2==1) * (W//2) H%2==1 H%2 H 2 1 W//2 W 2 (W%2==1) * (H//2) W%2==1 W%2 W 2 1 H//2 H 2 for s,c in B:
        if c%2==1:
            if flag_odd:
                print("No")
                return
            flag_odd = True
        elif c%4==2:
            upper_2 -= 1
            if upper_2<0:
                print("No")
                return
     s c B if c%2==1:
            if flag_odd:
                print("No")
                return
            flag_odd = True
        elif c%4==2:
            upper_2 -= 1
            if upper_2<0:
                print("No")
                return
     c%2==1 c%2 c 2 1 if flag_odd:
                print("No")
                return
             flag_odd print("No") print "No" return flag_odd = True flag_odd True elif c%4==2:
            upper_2 -= 1
            if upper_2<0:
                print("No")
                return
     c%4==2 c%4 c 4 2 upper_2 -= 1 upper_2 1 if upper_2<0:
                print("No")
                return
     upper_2<0 upper_2 0 print("No") print "No" return print("Yes") print "Yes" return def examC():
    N, K = LI()
    P = LI()
    C = LI()

    if max(C)<0:
        print(max(C))
        return

    loop = [[0,0]for _ in range(N)]

    for i in range(N):
        checked = set()
        now = i
        score = 0
        while(now not in checked):
            checked.add(now)
            now = P[now]-1
            score += C[now]
        n = len(checked)
        for j in checked:
            loop[j] = [n,score]
    # print(loop)
    ans = 0
    for i in range(N):
        n,s = loop[i]
        score = 0
        if s>0:
            score += (K//n - 1) * s
        ans = max(ans,score)
        now = i
        for j in range(n + K%n):
            now = P[now] - 1
            score += C[now]
            ans = max(ans,score)

    print(ans)
    return examC N, K = LI() N LI() LI K P = LI() P LI() LI C = LI() C LI() LI if max(C)<0:
        print(max(C))
        return

     max(C)<0 max(C) max C 0 print(max(C)) print max(C) max C return [0,0]for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) [0,0] 0 0 loop = [[0,0]for _ in range(N)] loop [[0,0]for _ in range(N)] for i in range(N):
        checked = set()
        now = i
        score = 0
        while(now not in checked):
            checked.add(now)
            now = P[now]-1
            score += C[now]
        n = len(checked)
        for j in checked:
            loop[j] = [n,score]
    # print(loop)
     i range(N) range N checked = set() checked set() set now = i now i score = 0 score 0 while(now not in checked):
            checked.add(now)
            now = P[now]-1
            score += C[now]
         now not in checked now checked checked.add(now) checked.add checked add now now = P[now]-1 now P[now]-1 P[now] P now 1 score += C[now] score C[now] C now n = len(checked) n len(checked) len checked for j in checked:
            loop[j] = [n,score]
    # print(loop)
     j checked loop[j] = [n,score] loop[j] loop j [n,score] n score ans = 0 ans 0 for i in range(N):
        n,s = loop[i]
        score = 0
        if s>0:
            score += (K//n - 1) * s
        ans = max(ans,score)
        now = i
        for j in range(n + K%n):
            now = P[now] - 1
            score += C[now]
            ans = max(ans,score)

     i range(N) range N n,s = loop[i] n loop[i] loop i s score = 0 score 0 if s>0:
            score += (K//n - 1) * s
         s>0 s 0 score += (K//n - 1) * s score (K//n - 1) * s K//n - 1 K//n K n 1 s ans = max(ans,score) ans max(ans,score) max ans score now = i now i for j in range(n + K%n):
            now = P[now] - 1
            score += C[now]
            ans = max(ans,score)

     j range(n + K%n) range n + K%n n K%n K n now = P[now] - 1 now P[now] - 1 P[now] P now 1 score += C[now] score C[now] C now ans = max(ans,score) ans max(ans,score) max ans score print(ans) print ans return def examD():
    ans = 0
    print(ans)
    return examD ans = 0 ans 0 print(ans) print ans return def examE():
    ans = 0
    print(ans)
    return examE ans = 0 ans 0 print(ans) print ans return def examF():
    ans = 0
    print(ans)
    return examF ans = 0 ans 0 print(ans) print ans return def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return test i = I() i I() I li = LI() li LI() LI lsi = LSI() lsi LSI() LSI si = LS() si LS() LS print(i) print i print(li) print li print(lsi) print lsi print(si) print si return from decimal import getcontext,Decimal as dec import sys,bisect,itertools,heapq,math,random sys bisect itertools heapq math random from copy import deepcopy from heapq import heappop,heappush,heapify from collections import Counter,defaultdict,deque read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines def I(): return int(input()) I def LI(): return list(map(int,sys.stdin.readline().split())) LI def DI(): return dec(input()) DI def LDI(): return list(map(dec,sys.stdin.readline().split())) LDI def LSI(): return list(map(str,sys.stdin.readline().split())) LSI def LS(): return sys.stdin.readline().split() LS def SI(): return sys.stdin.readline().strip() SI global mod,mod2,inf,alphabet,alphabet_convert,_ep mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 mod2 = 998244353 mod2 998244353 inf = 1<<31 inf 1<<31 1 31 _ep = dec("0.000000000001") _ep dec("0.000000000001") dec "0.000000000001" chr(ord('a') + i) for i in range(26) for i in range(26) i range(26) range 26 for i in range(26) chr(ord('a') + i) chr ord('a') + i ord('a') ord 'a' i alphabet = [chr(ord('a') + i) for i in range(26)] alphabet [chr(ord('a') + i) for i in range(26)] chr(ord('a') + i): i for i in range(26) for i in range(26) i range(26) range 26 for i in range(26) chr(ord('a') + i) chr ord('a') + i ord('a') ord 'a' i i alphabet_convert = {chr(ord('a') + i): i for i in range(26)} alphabet_convert {chr(ord('a') + i): i for i in range(26)} getcontext().prec = 28 getcontext().prec () getcontext prec 28 sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main """
142
12 9 1445 0 1
asd dfg hj o o
aidn
""" def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return test def LSI(): return list(map(str,sys.stdin.readline().split())) def LSI(): return list(map(str,sys.stdin.readline().split())) LSI def SI(): return sys.stdin.readline().strip() def SI(): return sys.stdin.readline().strip() SI mod = 10**9 + 7 10**9 + 7 mod mod2 = 998244353 998244353 mod2 global mod,mod2,inf,alphabet,alphabet_convert,_ep def DI(): return dec(input()) def DI(): return dec(input()) DI def examD():
    ans = 0
    print(ans)
    return def examD():
    ans = 0
    print(ans)
    return examD readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines def examB():
    H, W = LI()
    A = [SI()for _ in range(H)]
    C = defaultdict(int)
    for a in A:
        for s in a:
            C[s] += 1
    B = sorted(C.items())
    # print(B)
    flag_odd = not (H%2==1 and W%2==1)
    upper_2 = (H%2==1) * (W//2) + (W%2==1) * (H//2)
    for s,c in B:
        if c%2==1:
            if flag_odd:
                print("No")
                return
            flag_odd = True
        elif c%4==2:
            upper_2 -= 1
            if upper_2<0:
                print("No")
                return
    print("Yes")
    return def examB():
    H, W = LI()
    A = [SI()for _ in range(H)]
    C = defaultdict(int)
    for a in A:
        for s in a:
            C[s] += 1
    B = sorted(C.items())
    # print(B)
    flag_odd = not (H%2==1 and W%2==1)
    upper_2 = (H%2==1) * (W//2) + (W%2==1) * (H//2)
    for s,c in B:
        if c%2==1:
            if flag_odd:
                print("No")
                return
            flag_odd = True
        elif c%4==2:
            upper_2 -= 1
            if upper_2<0:
                print("No")
                return
    print("Yes")
    return examB def LDI(): return list(map(dec,sys.stdin.readline().split())) def LDI(): return list(map(dec,sys.stdin.readline().split())) LDI def examC():
    N, K = LI()
    P = LI()
    C = LI()

    if max(C)<0:
        print(max(C))
        return

    loop = [[0,0]for _ in range(N)]

    for i in range(N):
        checked = set()
        now = i
        score = 0
        while(now not in checked):
            checked.add(now)
            now = P[now]-1
            score += C[now]
        n = len(checked)
        for j in checked:
            loop[j] = [n,score]
    # print(loop)
    ans = 0
    for i in range(N):
        n,s = loop[i]
        score = 0
        if s>0:
            score += (K//n - 1) * s
        ans = max(ans,score)
        now = i
        for j in range(n + K%n):
            now = P[now] - 1
            score += C[now]
            ans = max(ans,score)

    print(ans)
    return def examC():
    N, K = LI()
    P = LI()
    C = LI()

    if max(C)<0:
        print(max(C))
        return

    loop = [[0,0]for _ in range(N)]

    for i in range(N):
        checked = set()
        now = i
        score = 0
        while(now not in checked):
            checked.add(now)
            now = P[now]-1
            score += C[now]
        n = len(checked)
        for j in checked:
            loop[j] = [n,score]
    # print(loop)
    ans = 0
    for i in range(N):
        n,s = loop[i]
        score = 0
        if s>0:
            score += (K//n - 1) * s
        ans = max(ans,score)
        now = i
        for j in range(n + K%n):
            now = P[now] - 1
            score += C[now]
            ans = max(ans,score)

    print(ans)
    return examC def I(): return int(input()) def I(): return int(input()) I alphabet = [chr(ord('a') + i) for i in range(26)] [chr(ord('a') + i) for i in range(26)] alphabet def examA():
    S = SI()
    S = ">" + S + "<"
    N = len(S)
    A = [0]*N
    i = 0
    while(i<N-1):
        r = i + 1
        if S[i]==">" and S[i+1]=="<":
            A[i] = 0
            l = i-1
            cur = 0
            while(1<=l):
                cur += 1
                A[l] = max(A[l], cur)
                l -= 1
                if S[l+1]=="<":
                    #print("break",l,A)
                    break
            r = i+1
            cur = 0
            while(r<N-1):
                cur += 1
                A[r] = max(A[r], cur)
                r += 1
                if r==N-1:
                    break
                if S[r]==">":
                    break
        #print(i,A)
        i = r
    #print(A)
    A[0] = 0; A[-1] = 0
    ans = sum(A)
    print(ans)
    return def examA():
    S = SI()
    S = ">" + S + "<"
    N = len(S)
    A = [0]*N
    i = 0
    while(i<N-1):
        r = i + 1
        if S[i]==">" and S[i+1]=="<":
            A[i] = 0
            l = i-1
            cur = 0
            while(1<=l):
                cur += 1
                A[l] = max(A[l], cur)
                l -= 1
                if S[l+1]=="<":
                    #print("break",l,A)
                    break
            r = i+1
            cur = 0
            while(r<N-1):
                cur += 1
                A[r] = max(A[r], cur)
                r += 1
                if r==N-1:
                    break
                if S[r]==">":
                    break
        #print(i,A)
        i = r
    #print(A)
    A[0] = 0; A[-1] = 0
    ans = sum(A)
    print(ans)
    return examA def examF():
    ans = 0
    print(ans)
    return def examF():
    ans = 0
    print(ans)
    return examF def main():
    examC() def main():
    examC() main _ep = dec("0.000000000001") dec("0.000000000001") _ep def examE():
    ans = 0
    print(ans)
    return def examE():
    ans = 0
    print(ans)
    return examE inf = 1<<31 1<<31 inf def LS(): return sys.stdin.readline().split() def LS(): return sys.stdin.readline().split() LS read = sys.stdin.buffer.read sys.stdin.buffer.read read def LI(): return list(map(int,sys.stdin.readline().split())) def LI(): return list(map(int,sys.stdin.readline().split())) LI alphabet_convert = {chr(ord('a') + i): i for i in range(26)} {chr(ord('a') + i): i for i in range(26)} alphabet_convert
def main():
    examC()

def examA():
    S = SI()
    S = ">" + S + "<"
    N = len(S)
    A = [0]*N
    i = 0
    while(i<N-1):
        r = i + 1
        if S[i]==">" and S[i+1]=="<":
            A[i] = 0
            l = i-1
            cur = 0
            while(1<=l):
                cur += 1
                A[l] = max(A[l], cur)
                l -= 1
                if S[l+1]=="<":
                    #print("break",l,A)
                    break
            r = i+1
            cur = 0
            while(r<N-1):
                cur += 1
                A[r] = max(A[r], cur)
                r += 1
                if r==N-1:
                    break
                if S[r]==">":
                    break
        #print(i,A)
        i = r
    #print(A)
    A[0] = 0; A[-1] = 0
    ans = sum(A)
    print(ans)
    return

def examB():
    H, W = LI()
    A = [SI()for _ in range(H)]
    C = defaultdict(int)
    for a in A:
        for s in a:
            C[s] += 1
    B = sorted(C.items())
    # print(B)
    flag_odd = not (H%2==1 and W%2==1)
    upper_2 = (H%2==1) * (W//2) + (W%2==1) * (H//2)
    for s,c in B:
        if c%2==1:
            if flag_odd:
                print("No")
                return
            flag_odd = True
        elif c%4==2:
            upper_2 -= 1
            if upper_2<0:
                print("No")
                return
    print("Yes")
    return

def examC():
    N, K = LI()
    P = LI()
    C = LI()

    if max(C)<0:
        print(max(C))
        return

    loop = [[0,0]for _ in range(N)]

    for i in range(N):
        checked = set()
        now = i
        score = 0
        while(now not in checked):
            checked.add(now)
            now = P[now]-1
            score += C[now]
        n = len(checked)
        for j in checked:
            loop[j] = [n,score]
    # print(loop)
    ans = 0
    for i in range(N):
        n,s = loop[i]
        score = 0
        if s>0:
            score += (K//n - 1) * s
        ans = max(ans,score)
        now = i
        for j in range(n + K%n):
            now = P[now] - 1
            score += C[now]
            ans = max(ans,score)

    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,alphabet_convert,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<31
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    main()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""