Harryxun/stf_run huggingface dataset:
from scipy.special import comb

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

pre = 0
last = -1
ans_l = []
flag = False
l.append(N+1)
for i in l:
    if i==1:
        last = 1
        continue
    if i-last==1:
        flag =True
        break
    n = i - last - 3
    r = 0
    tmp = 1
    dif = 1
    # print("n",n)
    while dif>0:
        r += 1
        tmp += comb(n, r, exact=True)
        dif = n-r
        n -= 1
        # print("tmp",tmp,n,r)
    ans_l.append(tmp)
    # print(i,ans_l)
    last = i
if flag:
    print(0)
else:
    ans = 1
    for i in ans_l:
        ans*=i
    print(ans%1000000007)

### FIXED CODE ###

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

mod = 10**9+7
dp = {}
for i in range(N+1):
    dp[i] = 1
dp[1] = 0 if 1 in l else 1

for i in range(2,N+1):
    if i in l:
        dp[i] = 0
        continue
    else:
        dp[i] = dp[i-1]%mod + dp[i-2]%mod
        dp[i] = dp[i]%mod

print(dp[N]%mod)
from math import gcd
def lcm(a, b):
    return a*b//gcd(a, b)
n = input()
arr = input().split(' ')
arr = [int(a) for a in arr]
tmp = arr[0]
for i in range(len(arr)-1):
    tmp = lcm(tmp,arr[i+1])
ans = sum([tmp/a for a in arr])
ans = int(ans % (1e+9+7))
print(ans)

### FIXED CODE ###

import sys
from fractions import gcd
input = sys.stdin.readline

n = input()
arr = list(map(int, input().split()))
tmp = arr[0]
for i in arr:
    tmp = tmp*i//gcd(tmp,i)
print(sum(tmp//a for a in arr) % (10**9+7))
import sys
#import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N = ri()
A = [rl().reverse() for _ in range(N)]
answer = 0
match = 0
while A:
    bool = False
    for i in range(N):
        op = A[i][-1] - 1
        if op > i and A[op] == i:
            match += 1
            bool = True
            A[i].pop()
            A[op].pop()
    if not bool:
        print(-1)
        exit()
    answer += 1
    if match == N * (N-1) // 2:
        break

print(answer)


### FIXED CODE ###

import sys
import copy
from collections import deque

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = [deque(lr()) for _ in range(N)]

match = 0
candidate = []
used = set()
for i in range(N):    
    bool = False
    if len(A[i]) == 0:
        continue
    op = A[i][0] - 1
    if op in used or i in used:
        continue
    if A[op][0]-1 == i:
        used.add(i)
        used.add(op)
        candidate.extend([i, op])
        match += 1
        bool = True
        A[i].popleft()
        A[op].popleft()
answer = 1

while True:
    used = set()
    bool = False
    c = []
    for i in candidate:
        if len(A[i]) == 0:
            continue
        op = A[i][0] - 1
        if op in used or i in used:
            continue
        if A[op][0]-1 == i:
            used.add(i)
            used.add(op)
            match += 1
            c.extend([i, op])
            bool = True
            A[i].popleft()
            A[op].popleft()
    
    answer += 1
    candidate = c
    if match == N * (N-1) // 2:
        break
    if not bool:
        print(-1)
        exit()

print(answer)
n=int(input())
a=[2,1]
for i in range(84):
    a.append(a[i]+a[i+1])
print(a[n])

### FIXED CODE ###

n=int(input())
a=[2,1]
for i in range(100):
    a.append(a[i]+a[i+1])
print(a[n])
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools


def main():
  r = (99, 2, 5, 5, 4, 5, 6, 3, 7, 6)
  n, _ = list(map(int, input().split()))
  ps = list(map(int, input().split()))

  cs = [(p, r[p]) for p in ps]
  cs.sort(key=lambda x: x[1])
  a = []
  s, b = cs[0]

  while n - b > 0:
    a.append(s)
    n -= b

  cs.sort(key=lambda x:-x[0])
  cs = [(p, c - b) for p, c in cs if c != b]
  ds = None

  for i in range(1, len(cs) + 1):
    for ps in itertools.product(range(len(cs)), repeat=i):
      print(ps)
      if sum(cs[p][1] for p in ps) == n:
        ds = [cs[p][0] for p in ps]
        break

    if ds is not None:
      break

  uds = [d for d in ds if d >= s]
  lds = [d for d in ds if d < s][::-1]

  a = uds + a[len(uds):]
  a = a[-len(lds):] + lds

  print(''.join(str(v) for v in a), flush=True)


if __name__ == '__main__':
  main()



### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools

COSTS = (99, 2, 5, 5, 4, 5, 6, 3, 7, 6)


def gen(base_digit, base_cost, base_length, digits, remain):
  number = [base_digit] * base_length
  remain -= base_cost * base_length

  if remain == 0:
    print(''.join(str(d) for d in number), flush=True)
    return True

  digits = [(d, c - base_cost) for d, c in digits if d != base_digit and c - base_cost <= remain]

  if len(digits) == 0:
    return False

  max_repeat = min(remain // min(digits, key=lambda x: x[1])[1], len(number))
  numbers = []

  for repeat in range(1, max_repeat + 1):
    for idxs in itertools.product(range(len(digits)), repeat=repeat):
      if sum(digits[i][1] for i in idxs) != remain:
        continue

      replaces = [digits[i][0] for i in idxs]
      uppers = [d for d in replaces if d > base_digit]
      lowers = [d for d in replaces if d < base_digit]

      num = number[:]

      if len(uppers) > 0:
        num = uppers + num[len(uppers):]

      if len(lowers) > 0:
        num = num[:-len(lowers)] + lowers

      numbers.append(num)

  if len(numbers) == 0:
    return False

  number = max(numbers)

  print(''.join(str(d) for d in number), flush=True)

  return True


def main():
  remain, _ = list(map(int, input().split()))

  digits = {}

  for d in map(int, input().split()):
    if COSTS[d] not in digits or digits[COSTS[d]] < d:
      digits[COSTS[d]] = d

  digits = [(d, c) for c, d in digits.items()]
  base_digit, base_cost = min(digits, key=lambda x: x[1])

  for length in range(remain // base_cost, -1, -1):
    if gen(base_digit, base_cost, length, digits, remain):
      break


if __name__ == '__main__':
  main()
from sys import stdin


class Rec_memo:
    def __init__(self, N, h_arr):
        self.dp = [float('inf')] * (N+2)
        self.h_arr = h_arr

    def rec(self, i):
        if self.dp[i] < float('inf'):
            return self.dp[i]
        elif i == 0:
            return 0
        else:
            res = float('inf')
            res = min(res,self.rec(i-1)+abs(self.h_arr[i]-self.h_arr[i-1]))
            if i>1:
                res = min(res,self.rec(i-2)+abs(self.h_arr[i]-self.h_arr[i-2]))
            self.dp[i] = res
            return res


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    h_arr = [0] * (N+2)
    h_arr[0:N] = list(map(int,_in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    # dp[i]:=カエルが足場iへと移動するのに必要な最小コスト
    #dp = [float('inf')] * (N+2)  # 最小化問題
    #dp[0] = 0                    # 初期条件
    
    # 貰うDP
    #for i in range(0,N):
    #    dp[i] = min(dp[i],dp[i-1]+abs(h_arr[i]-h_arr[i-1]))
    #    if i > 1:
    #        dp[i] = min(dp[i],dp[i-2]+abs(h_arr[i]-h_arr[i-2]))
    #cnt = dp[N-1]

    # 配るDP
    #for i in range(0,N):
    #    dp[i+1] = min(dp[i+1],dp[i]+abs(h_arr[i]-h_arr[i+1]))
    #    dp[i+2] = min(dp[i+2],dp[i]+abs(h_arr[i]-h_arr[i+2]))
    #cnt = dp[N-1]

    # メモ化再帰
    memo = Rec_memo(N,h_arr)
    cnt = memo.rec(N-1)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


### FIXED CODE ###

from sys import stdin


# 最小化問題
def chmin(a,b):
    if a > b: return b
    else: return a


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    h_arr = list(map(int,_in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    dp = [float('inf')] * N  # 最小化問題
    dp[0] = 0                # 初期条件
    
    for i in range(0,N):
        dp[i] = chmin(dp[i],dp[i-1]+abs(h_arr[i]-h_arr[i-1]))
        if i > 1:
            dp[i] = chmin(dp[i],dp[i-2]+abs(h_arr[i]-h_arr[i-2]))
    cnt = dp[N-1]
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)
x = int(input())
if x = 1:
  print("0")
else:
  print("1")

### FIXED CODE ###

x = int(input())
if x == 1:
  print(0)
else:
  print(1)
# A - A?C
S = int(input())
if S=='ABC':
    print('ARC')
else:
    print('ABC')

### FIXED CODE ###

# A - A?C
S = input()
if S=='ABC':
    print('ARC')
else:
    print('ABC')
H, W , N = map(int,input().split())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
    x,y = map(int,input().split())
    matrix.append([x-1,y-1])
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
    for x_r in [-2, -1 , 0]:
        for y_r in [-2, -1 , 0]:
            nowx = l[0] + x_r
            nowy = l[1] + y_r
            if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
                continue
            #ここで起点(左上)nowx, nowy として　 9マスに着目する
            name = str(nowx) + ' '  +str(nowy)
            if name in cand : cand[name] += 1
            else: cand[name] = 1
tmp = ((H - 2) * (W - 2))
[ans[x]+=1 for x in cand.values()]
ans[0] -= len(cand)
for x in ans:
    print(x)


### FIXED CODE ###

H, W , N = map(int,input().split())
from bisect import bisect_left
from bisect import bisect_right
matrix = []
for _ in range(N):
    x,y = map(int,input().split())
    x -= 1
    y -= 1
    matrix.append([x,y])
matrix.sort()
ans = [0 for _ in range(10)]
cand = {}
for l in matrix:
    for x_r in [-2, -1 , 0]:
        for y_r in [-2, -1 , 0]:
            nowx = l[0] + x_r
            nowy = l[1] + y_r
            if nowx < 0 or nowy < 0 or nowx + 2>= H or nowy+ 2 >= W:
                continue
            #ここで起点(左上)nowx, nowy として　 9マスに着目する
            name = str(nowx) +"hoge" +str(nowy)
            try: cand[name] += 1
            except: cand[name] = 1
tmp = ((H - 2) * (W - 2))
for x in cand.values():
    ans[x] += 1
    tmp -= 1
ans[0] = tmp
for x in ans:
    print(x)
n, x = [int(i) for i in input().split()]

3 <= n <= 100

if n == x == 0:
    break

for a in range(1, n+1):
    for b in range(1, a):
        for c in range(1, b-1):
             if a == b == c or a == b or a == c or b == c:
             None
             if a + b + c == x:
             return
             else:
             None
print()

### FIXED CODE ###

while True:
    n, x = [int(i) for i in input().split()]

    if n == x == 0:
        break

    count = 0
    for s in range(1, n+1):
        for m in range(s+1, n):
            for e in range(m+1, n+1):
                if x == sum([s, m, e]):
                    count += 1

    print(count)
import decimal from decimal
import math

A, B = input().split()

B = decimal(B)
A = int(A)
product = A*B

print(math.floor(product))

### FIXED CODE ###

from decimal import Decimal
import math

A, B = input().split()

B = Decimal(B)
A = int(A)
product = A*B

print(math.floor(product))
def search_by_dict(s1, s2):
    d = defaultdict(list)

    for i in range(len(s1)-len(s2)):
        d[s1[i:i+len(s2)]].append(i)

    return (i for i in d[s2])


def run():
    s1 = input()
    s2 = input()
    for idx in search_by_dict(s1, s2):
        print(idx)


if __name__ == '__main__':
    run()


### FIXED CODE ###

class RKSearch:
    shift = 40
    size = 33554393

    def __init__(self, s1, s2):
        self.haystack = self._encode(s1)
        self.needle = self._encode(s2)

    def find(self):
        m, n = len(self.haystack), len(self.needle)
        if m < n:
            return

        h1 = self._hash(self.haystack, n)
        h2 = self._hash(self.needle, n)
        dm = self.shift**(n-1) % self.size

        for i in range(m-n+1):
            if h1 == h2:
                yield i
            if i+n < m:
                h1 = ((h1 - self.haystack[i]*dm) * self.shift
                      + self.haystack[i+n]) % self.size

    def _hash(self, s, length):
        h = 0
        for i in range(length):
            h = (h * self.shift + s[i]) % self.size

        return h

    def _encode(cls, s):
        basea = int.from_bytes(b'a', 'little')
        based = int.from_bytes(b'0', 'little')
        bs = []
        for c in s:
            if c.isdigit():
                bs.append(int.from_bytes(c.encode('utf8'), 'little')-based+27)
            else:
                bs.append(int.from_bytes(c.encode('utf8'), 'little')-basea)

        return bs


def run():
    s1 = input()
    s2 = input()
    rk = RKSearch(s1, s2)
    for i in rk.find():
        print(i)


if __name__ == '__main__':
    run()
s = str(input())
s[3] = "8"
print(s)

### FIXED CODE ###

s = list(map(str,input()))
s[3] = "8"
print(*s,sep="")
s=input().split(,)
print(s[0],s[1],s[2])

### FIXED CODE ###

s=input().split(',')
print(s[0],s[1],s[2])
import itertools

def resolve():
    n, m = map(int, input().split())
    S = [[0]*m for i in range(m)]
    MOD = (10 ** 9) + 7

    for i in range(m):
        a, b = map(int, input().split())
        S[a-1][b-1] = 1
        S[b-1][a-1] = 1

    ans = 0
    for p in itertools.permutations(range(0, m)):
        if p == (0,2,3,4,5,6,1):
            pass
        if p[0] != 0:
            break;
        tmp = 1
        for i, v in enumerate(p):
            if i + 1 < m:
                tmp *= S[v][p[i+1]]
        ans += tmp

    print(ans % MOD)

if __name__ == '__main__':
    resolve()

### FIXED CODE ###

# サンプルコード計算量お試し

import itertools

N, M = map(int, input().split())
adj_matrix = [[0]* N for _ in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    adj_matrix[a-1][b-1] = 1
    adj_matrix[b-1][a-1] = 1

cnt = 0

for each in itertools.permutations(range(N)):
    if each[0] != 0:
        break
    factor = 1
    for i in range(N-1):
        factor *= adj_matrix[each[i]][each[i+1]]
    cnt += factor

print(cnt)
s=input()
if(s=="ABC"):
  print("ARC")
 else:
  print("ABC")

### FIXED CODE ###

s=input()
if(s=="ABC"):
  print("ARC")
else:
  print("ABC")
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

N, M = map(int, input().split())
candi = [True for _ in range(101010)]
for d in make_divisors(N):
    if d > 1:
        candi[d] = False

ans = []
l, r = 1, N
for i in range(M):
    if not candi[r-l]:
        while not candi[r-l]:
            r -= 1
    ans.append([l, r])
    l += 1
    r -= 1

for i in range(M):
    print(" ".join(map(str, ans[i])))

### FIXED CODE ###

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

ans = []
if M%2 == 0:
    for i in range(1, M//2+1):
        ans.append([i, M+1-i])
        ans.append([M+i, 2*M+2-i])
else:
    for i in range(1, M//2+1):
        ans.append([i, M+1-i])
    for i in range(1, (M+1)//2+1):
        ans.append([M+i, 2*M+2-i])

for i in range(len(ans)):
    print(*ans[i])
n = int(input())
a = []
for x in input().split():
    a.append(int(x))

ans = []

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

for i in range(n):
    c = a.copy()
    c.remove(a[i])
    ans.append(gcd_list(c))

print(max(ans))


### FIXED CODE ###

def gcd(x,y):
    if x<y:
        x,y=y,x
    #x>y
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)

N=int(input())
A=[int(i) for i in input().split()]
X=[0 for i in range(N)]
Y=[0 for i in range(N)]
for i in range(1,N):
    X[i]=gcd(X[i-1],A[i-1])
for i in range(N-1)[::-1]:
    Y[i]=gcd(Y[i+1],A[i+1])
Z=[gcd(X[i],Y[i]) for i in range(N)]
print(max(Z))
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
x, y, z, kk = list(map(int, input().split()))

# 1整数
# n = int(input())

# 空白区切りリスト整数
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)


ll = [0] * 1000000
count = 0
for i in range(len(a)):
    for j in range(len(b)):
        if i * j > kk:

            break
        for k in range(len(c)):
            if i * j * k > kk:
                break
            ll[count] = a[i] + b[j] + c[k]
            count += 1
ll.sort(reverse=True)

for i in range(kk):
    print(ll[i])

# 空白区切り文字列
# t, d = input().split()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
x, y, z, kk = list(map(int, input().split()))

# 1整数
# n = int(input())

# 空白区切りリスト整数
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)


ll = []
count = 0
for i in range(len(a)):
    for j in range(len(b)):
        if i * j > kk:

            break
        for k in range(len(c)):
            if i * j * k > kk:
                break
            ll.append(a[i] + b[j] + c[k])
ll.sort(reverse=True)

for i in range(kk):
    print(ll[i])

# 空白区切り文字列
# t, d = input().split()
x = int(input())
y + int(input())
sum = 0
if x ==1 and y ==1:
  sum += 400000

if x == 1:
  sum += 300000
elif x == 2 :
  sum += 200000
elif x == 3:
  sum += 100000
  
if y == 1:
  sum += 300000
elif y == 2 :
  sum += 200000
elif y == 3:
  sum += 100000

print(sum)

  
  


### FIXED CODE ###

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

sum = 0
if x ==1 and y ==1:
  sum += 400000
 
if x == 1:
  sum += 300000
elif x == 2 :
  sum += 200000
elif x == 3:
  sum += 100000
  
if y == 1:
  sum += 300000
elif y == 2 :
  sum += 200000
elif y == 3:
  sum += 100000
 
print(sum)
n=input()
a=list(map(int,input().split()))

count==0
all=[]

for i in range(n):
  if a[i]%2 ==0:
    while true:
      if a[i]%2==0:
        count+=1
      else:
        break
    all.append(count)
    
print(max(count))
    

### FIXED CODE ###

import math

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

count=0

while True:
  ch = 0
  for i in range(n):
    if a[i]%2 != 0:
      ch += 1
  if ch == 0:
    
    for j in range(n):
      a[j]= a[j]/2
    count +=1
  else:
    break


    
print(count)
import numpy as np


def main():
    H, W = [int(x) for x in input().split()]
    board = [[0 for i in range(H)] for j in range(W)]

    """ #は1, .は0 """
    for i in range(H):
        X = input()
        for j in range(len(X)):
            if X[j] == "#":
                board[i][j] = 1

    num_board = np.array(board)
    height, width = num_board.shape[:2]
    count = 0
    height_r, width_r = range(height), range(width)
    for _ in height*width:
        num_board_ans = np.zeros((height, width))
        for i in height_r:
            for j in width_r:
                if num_board[i, j] == 1:
                    num_board_ans[i, j] = 1
                    a = max(i-1, 0)
                    num_board_ans[a, j] = 1
                    b = max(j-1, 0)
                    num_board_ans[i, b] = 1
                    c = min(i+1, height-1)
                    num_board_ans[c, j] = 1
                    d = min(j+1, width-1)
                    num_board_ans[i, d] = 1
        num_board = num_board_ans
        count += 1
        if (np.sum(num_board) == height*width):
            break

    print(count)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque


def bfs(h, w, board, visited):
    queue = deque([])
    for i in range(h):
        for j in range(w):
            if board[i][j] == "#":
                queue.append([i, j])
                visited[i][j] = 0
    ans = 0
    while queue:
        y, x = queue.popleft()
        for i, j in ([1, 0], [0, 1], [-1, 0], [0, -1]):
            yn, xn = y+i, x+j
            if yn >= h or xn >= w or yn < 0 or xn < 0:
                continue
            if visited[yn][xn] == -1 and board[yn][xn] == ".":
                visited[yn][xn] = visited[y][x] + 1
                queue.append([yn, xn])
                ans = max(ans, visited[yn][xn])

    return ans


def main():
    h, w = map(int, input().split())
    board = [input() for _ in range(h)]
    visited = [[-1 for _ in range(w)] for _ in range(h)]
    print(bfs(h, w, board, visited))


if __name__ == "__main__":
    main()
n = int(input())
n_list =[]
for i in range(n+1):
  n_list.append(int(input()))
print(len(set(n_list)))  


### FIXED CODE ###

n = int(input())
n_list =[]
for i in range(n):
  n_list.append(int(input()))
print(len(set(n_list)))
import sys
N=int(sys.stdin.readline())
L=list(map(int,sys.stdin.readline().split()))
count=[0]*N
C=list(set(L))
x=0
d=[0]*len(C)
e=[0]*N
for i in range(len(C)):
  d[i] = int((L.count(C[i]))*(L.count(C[i])-1)/2)
  x += d[i]  
for K in range(N):
  e[K] = L.count(L[K])-1
  print(x-e[K])


### FIXED CODE ###

N,M=map(int,input().split())
print(int(N*(N-1)/2+M*(M-1)/2))
a,b,x=map(int,input().split())
print("YES"  a<=x and x<=a+b else "NO" )



### FIXED CODE ###

a,b,x=map(int,input().split())
print("YES" if a<=x and x<=a+b else "NO" )
def main():
    n, k = map(int, input().split())
    r, s, p = map(int, input().split())
    t = list(input())
    score = {"r": p, "s": r, "p": s}
    answer = 0
    for i in range(n):
        if i < k:
            answer += score[t[i]]
            if t[i] == t[i + k]:
                t[i + k] = t[i + k] + "*"
        elif i + k < n:
            if "*" not in t[i]:
                answer += score[t[i][0]]
                if t[i] == t[i + k]:
                    t[i + k] = t[i + k] + "*"
        else:
            if "*" not in t[i]:
                answer += score[t[i][0]]
    print(answer)


if __name__ == '__main__':
    main()



### FIXED CODE ###

def main():
    N, K = map(int, input().split(" "))
    R, S, P = map(int, input().split(" "))
    strings = input()
    T = []
    for s in strings:
        T.append(s)
    score = {'r': P, 's': R, 'p': S}
    total = 0

    for i in range(K):
        total += score[T[i]]

    for j in range(K, N):
        if T[j] != T[j - K]:
            total += score[T[j]]
        else:
            T[j] = ' '
            continue

    print(total)

   
if __name__ == '__main__':
    main()
s = input()
t = input()
for i in renge(len(s))
  if s[i] == t[i]:
    continue
  else:
    print("No")
  
  if i == (len(s)-1):
    print("Yes")

### FIXED CODE ###

s = input()
t = input()
if s == t[:len(s):]:
  print("Yes")
else:
  print("No")
import numpy as np
n = int(input())
a = [int(x) for x in input().split()]

x = np.prod(a)

if x > 10**18:
    print("-1")
else:
    print(x)

### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split()]


ans = 1
a.sort()

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

print(ans)