Harryxun/stf_run huggingface dataset:
L=[]
M=[]
for i in range(5) :
  A=int(input())
  L.append(A)
  if A%10!=0 :
    M.append(10-A%10)
print(sum(L+M)-max(M))

### FIXED CODE ###

from math import ceil 
L=[]
X=0
M=int(input())
L.append(M)
for i in range(4) :
  A=int(input())
  L.append(A)
  if A%10 < M%10 and A%10!=0 :
    M=A
L.remove(M)
for i in L :
  X+=ceil(i/10)*10
print(X+M)
x,y = str(input()),str(input())

def rep(a):
  if a == 'A':
    a = 10
  elif a == "B":
    a = 11
  elif a == "C":
    a = 12  
  elif a == "D":
    a = 13
  elif a == "E":
    a = 14
  elif a == "F":
    a = 15
  return None
    
rep(x)
rep(y)

if x < y:
  print("<")
elif x > y:
  print(">")
else:
  print("=")



### FIXED CODE ###

x,y = map(str,input().split())

if ord(x) > ord(y):
  print(">")
elif ord(x) < ord(y):
  print("<")
else:
  print("=")
s = input()
L = []
alp = [chr(ord('a') + i) for i in range(26)]
TF = [False]*26
for i in range(len(s)):
  if not s[i] in L:
    L.append(s[i])
    TF[ord(s[i])-97] = True
if len(L) != 26:
  for i in range(26):
    if TF[i] == False:
      k = alp[i]
      break
  print(s+k)
else:
  if s == 'zyxwvutsrqponmlkjihgfedcba':
    print(-1)
  elif s == 'abcdefghijklmnopqrstuvwxyz':
    print('b')
  else:
    for i in range(25):
      if ord(s[i+1])-ord(s[i]) != 1:
        break
    print(s[0:i]+alp[ord(s[i])-97+1])

### FIXED CODE ###

import sys
s = input()
L = []
alp = [chr(ord('a') + i) for i in range(26)]
TF = [False]*26
for i in range(len(s)):
  if not s[i] in L:
    L.append(s[i])
    TF[ord(s[i])-97] = True
if len(L) != 26:
  for i in range(26):
    if TF[i] == False:
      k = alp[i]
      break
  print(s+k)
else:
  right = s[-1]
  for i in reversed(range(len(s))):
    k = s[i]
    if k < right:
      for j in range(ord(k),ord(k)+26):
        if chr(j) in s[i+1:]:
          print(s[:i]+chr(j))
          break
      sys.exit()
    else:
      right = max(k,right)
  print(-1)
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

ans = [0] * m + [n * (n - 1) // 2]

root = [0] * (n + 1)
count = [1] * (n + 1)

def uf(a):
    if root[a] == 0:
        return a
    else:
        return uf(root[a])

ab.reverse()
for i in range(len(ab)):
    ha = uf(ab[i][0])
    hb = uf(ab[i][1])
    if ha == hb:
        continue
    ans[m - i - 1] = max(0, ans[m - i] - count[ha] * count[hb])
    root[hb] = ha
    count[ha] += count[hb]
ans.pop(0)
for i in ans:
    print(i)

### FIXED CODE ###

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

ans = [0] * (m - 1) + [n * (n - 1) // 2]

root = [0] * (n + 1)
count = [1] * (n + 1)

def uf(a):
    if root[a] == 0:
        return a
    else:
        return uf(root[a])

for i in range(m - 1, 0, -1):
    ha = uf(ab[i][0])
    hb = uf(ab[i][1])
    if ha == hb:
        ans[i - 1] = ans[i]
        continue
    ans[i - 1] = max(0, ans[i] - count[ha] * count[hb])
    if count[ha] > count[hb]:
        root[hb] = ha
        count[ha] += count[hb]
    else:
        root[ha] = hb
        count[hb] += count[ha]
for i in ans:
    print(i)
X, N = [int(i) for i in input().split()]
if N==0:
    P = list(range(1, 101))
else:
    P = list(set(range(1, 101)) - {int(i) for i in input().split()})
P.sort()

D = [abs(P[i]-X) for i in range(len(P))]

print(P[D.index(min(D))])

### FIXED CODE ###

X, N = [int(i) for i in input().split()]
if N==0:
    print(X)
    quit()
P = list(set(range(-10, 110)) - {int(i) for i in input().split()})
# X = 10
# P = list(set(range(-10, 110)) - set(range(1, 101)))

P.sort()

D = [abs(P[i]-X) for i in range(len(P))]

print(P[D.index(min(D))])
#方針...gcd(A,B)の約数の中で素数or1となるものの個数を調べれば良い(O(route N))
import math

def prime_fac(N):
    primes = {1:1}
    n = int(math.sqrt(N))
    for i in range(2,n+1):
        if N%i==0:
            primes[i] = 0
            while N%i==0:
                primes[i] += 1
                N = N//i
    if (N!=1):
        primes[N] = 1
    return primes

A,B = list(map(int,input().split()))
C = math.gcd(A,B)
primes = prime_fac(C)

print(len(primes))

### FIXED CODE ###

#方針...gcd(A,B)の約数の中で素数or1となるものの個数を調べれば良い(O(route N))
import fractions
import math

def prime_fac(N):
    primes = {1:1}
    n = int(math.sqrt(N))
    for i in range(2,n+1):
        if N%i==0:
            primes[i] = 0
            while N%i==0:
                primes[i] += 1
                N = N//i
    if (N!=1):
        primes[N] = 1
    return primes

A,B = list(map(int,input().split()))
C = fractions.gcd(A,B)
primes = prime_fac(C)

print(len(primes))
p,q,r = int(input())
print(min(p+q, p+p+r, q+r, q+q+p, r+p, r+r+q))

### FIXED CODE ###

p,q,r = map(int,input().split())
print(min(p+q, p+p+r, q+r, q+q+p, r+p, r+r+q))
N, K = map(int, input().split())

ans = 0
extra = [0] * N
for i in range(1, N+1): extra[i%K] += 1 #extra[X] = Kで割ってXあまる数がN以下に何個あるか

for a in range(K):
    b = (K-a) % K
    c = (K-a) % K

    if (b + c) % K == 0:
        ans += extra[a] + extra[b] + extra[c]
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
ans = 0
extra = [0]*K
for i in range(1, N+1): extra[i%K] += 1 #extra[X] = Kで割ってXあまる数がN以下に何個あるか

for a in range(K):
    b = (K-a) % K
    c = (K-a) % K

    if (b + c) % K == 0:
        ans += extra[a] * extra[b] * extra[c]
print(ans)
T = input()
n = T.count("?")

S = T.replace("?", "D")
count1 = S.count("D") + S.count("PD")

for i, v in enumerate(T):
    if v == "?":
        if i == 0:
            if T[i + 1] == "D":
                T = T.replace("?", "P", 1)
            else:
                T = T.replace("?", "D", 1)
        else:
            if T[i - 1] == "P":
                T = T.replace("?", "D", 1)
            else:
                T = T.replace("?", "P", 1)

count2 = T.count("D") + T.count("PD")

print(T if count1 < count2 else S)

### FIXED CODE ###

T = input()
print(T.replace("?", "D"))
w, k = [],[]
for i in range(10):
    w.append(int(raw_input())
for i in range(10):
    k.append(int(raw_input())
print sum(sorted(w)[-3:]),sum(sorted(k)[-3:])

### FIXED CODE ###

a = []
for i in range(20):
    a.append(int(raw_input()))
print sum(sorted(a[:11])[-3:]),sum(sorted(a[11:])[-3:])
import string

count = {x: 0 for x in string. ascii_lowercase}
lines = ""

while True:
    try:
        lines += input().lower()
    except EOFError:
        break

for c in lines:
    if 'a' <= c <= 'z':
        count[c] += 1

for key, num in ascii_lowercase:
    print("{0} : {1}".format(key, count[key]))

### FIXED CODE ###

import string
   
count = {x: 0 for x in string.ascii_lowercase}
lines = ""
   
while True:
    try:
        lines += input().lower()
    except EOFError:
        break
           
for c in lines:
    if 'a' <= c <= 'z':
        count[c] += 1
           
for key in string.ascii_lowercase:
    print("{0} : {1}".format(key, count[key]))
n,k = map(int, input().split())
t=0

while n  >= k: 
    n = n // k
    t += 1
    
print(t+1)

### FIXED CODE ###

n,r = map(int, input().split())

if n>=10:
    print(r)
else:
    print(r+(100*(10-n)))
n,d,a=list(map(int,input().split()))
e=[]
for i in range(n):
  inp=list(map(int,input().split()))
  inp[1]=(inp[1]-1)//a+1
  e.append(inp)
e.sort()
sd=[0 for i in range(n)]
s=0
mx=0
i=0
j=0
while True:
  while e[i][1]+s<=mx:
    i+=1
    if i>=n:
      break
    s+=sd[i]
  while i<n and j<n and e[j][0]<=e[i][0]+2*d:
    j+=1
  if j<n:
      sd[j]=e[i][1]+s-mx
      mx=e[i][1]+s
  else:
    if i>=n:
      break
    mx=e[i][1]+s
    
print(mx)

### FIXED CODE ###

n,d,a=list(map(int,input().split()))
e=[]
for i in range(n):
  inp=list(map(int,input().split()))
  inp[1]=(inp[1]-1)//a+1
  e.append(inp)
e.sort()
sd=[0 for i in range(n)]
s=0
mx=0
i=0
j=0
while True:
  while e[i][1]+s<=mx:
    i+=1
    if i>=n:
      break
    s+=sd[i]
  while i<n and j<n and e[j][0]<=e[i][0]+2*d:
    j+=1
  if j<n:
      sd[j]+=e[i][1]+s-mx
      mx=e[i][1]+s
  else:
    if i>=n:
      break
    mx=e[i][1]+s
    
print(mx)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def solve(string):
    string = string.split("\n")
    n, m = map(int, string[0].split())
    ans = {i + 1 for i in range(m)}
    for loves in string[1:]:
        ans.intersection_update(set(map(int, loves.split()[1:])))
    return str(len(ans))


if __name__ == '__main__':
    base = input()
    n, m = map(int, base)
    tmp = [base]
    for _ in range(n):
        tmp.append(input())
    print(solve('\n'.join(tmp)))


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def solve(string):
    string = string.split("\n")
    n, m = map(int, string[0].split())
    ans = {i + 1 for i in range(m)}
    for loves in string[1:]:
        ans &= set(map(int, loves.split()[1:]))
    return str(len(ans))


if __name__ == '__main__':
    base = input()
    n, m = map(int, base.split())
    tmp = [base]
    for _ in range(n):
        tmp.append(input())
    print(solve('\n'.join(tmp)))
a=list(map(int,input().split()))
A=a[0]
B=a[1]

import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))


### FIXED CODE ###

a=list(map(int,input().split()))
A=a[0]
B=a[1]

import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print(lcm(A, B))
a, b, c = int(input())
print(a+b+c)

### FIXED CODE ###

a = list(input())
b = 0
for i in a:
    b += int(i)
print(b)
short = int(input())
long = int(input())
hour = int(input())
mini = int(input())
import math
shortx = short * math.sin( hour / 6 * math.pi )
shorty = short * math.cos( hour / 6 * math.pi )
longx = long * math.sin( mini / 30 * math.pi )
longy = long * math.cos( mini / 30 * math.pi )
c = math.sqrt((shortx - longx) ** 2 + (shorty - longy) ** 2 )
print(c)

### FIXED CODE ###

short , long , hour1 , mini = map(int, input().split())
hour2 = hour1 + mini / 60
import math
shortx = short * math.sin(math.radians( hour2 * 30 ))
shorty = short * math.cos(math.radians( hour2 * 30 ))
longx = long * math.sin(math.radians( mini * 6 ))
longy = long * math.cos(math.radians( mini * 6 ))
c = math.sqrt((shortx - longx) ** 2 + (shorty - longy) ** 2 )
print(c)
N=int(input())
import fraction
print(2*N//fraction.gcd(2,N))

### FIXED CODE ###

N=int(input())
from fractions import gcd
print(2*N//gcd(2,N))
S = input()

print("Heisei" if S <= 2019/4/30 else "TBD")

### FIXED CODE ###

year, month, day = map(int, input().split("/"))
if year <= 2019 and month <= 4 and day <= 30:
    print("Heisei")
else:
    print("TBD")
N = int(raw_input())
count = 0

A_str = raw_input().split()
A = map(int, A_str)

def merge(left, right):
    global count
    sorted_list = []
    l_index = 0
    r_index = 0

    while l_index < len(left) and r_index < len(right):
        count += 1
        if left[l_index] <= right[r_index]:
            sorted_list.append(left[l_index])
            l_index += 1
        else:
            sorted_list.append(right[r_index])
            r_index += 1

    if len(left) != l_index:
        sorted_list.extend(left[l_index:])
        count += len(left[l_index:])
    if len(right) != r_index:
        sorted_list.extend(right[r_index:])
        count += len(right[r_index:])

    return sorted_list 

def mergeSort(A):
    
    if len(A) <= 1:
        return A

    mid = len(A) // 2
    left = A[:mid]
    right = A[mid:]

    left = mergeSort(left)
    right = mergeSort(right)

    return list(merge(left, right))

print ' '.join(map(str, mergeSort(A)))print count

### FIXED CODE ###

N = int(raw_input())
count = 0

A_str = raw_input().split()
A = map(int, A_str)

def merge(left, right):
    global count
    sorted_list = []
    l_index = 0
    r_index = 0

    while l_index < len(left) and r_index < len(right):
        count += 1
        if left[l_index] <= right[r_index]:
            sorted_list.append(left[l_index])
            l_index += 1
        else:
            sorted_list.append(right[r_index])
            r_index += 1

    if len(left) != l_index:
        sorted_list.extend(left[l_index:])
        count += len(left[l_index:])
    if len(right) != r_index:
        sorted_list.extend(right[r_index:])
        count += len(right[r_index:])

    return sorted_list 

def mergeSort(A):
    
    if len(A) <= 1:
        return A

    mid = len(A) // 2
    left = A[:mid]
    right = A[mid:]

    left = mergeSort(left)
    right = mergeSort(right)

    return list(merge(left, right))

print ' '.join(map(str, mergeSort(A)))
print count
N, S = map(int,input.split())
A = list(map(int, input.split()))
mod = 998244353
dp = [[0 for j in range(S+1)] for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
	for j in range(S+1):
		dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])


### FIXED CODE ###

N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])
s = input()
t = input()
start, end = 0, len(t)
def f(s, t, start, end):
    min_changes = len(t)
    if start + len(t) == len(s):
        count = 0
        for i in range(len(t)):
            if s[start:end][i] != t[i]: count += 1
        return min(count, min_changes)
    return min(f(s, t, start+1, end+1), min_changes)

print(f(s, t, start, end))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
s = input()
t = input()
start, end = 0, len(t)
def f(s, t, start, end):
    min_changes = len(t)
    count = 0
    for i in range(len(t)):
        if s[start:end][i] != t[i]: count += 1
    if start + len(t) == len(s): return min(count, min_changes)
    else: return min(count, f(s, t, start+1, end+1))

print(f(s, t, start, end))
def main():
    n, p = map(int, input().split())
    s = input()
    mu = [None]*n
    ans = 0
    c = [0]*p
    if 10%p == 0:
        for i in range(n):
            if int(s[i])%p == 0:
                ans += i+1
        print(ans)
        return
    num = int(s)
    keta = n-1
    for i in range(n):
        v = num%p
        mu[i] = v
        c[v] += 1
        num -= si*10**keta
        keta -= 1
    c[0] += 1
    for i in mu:
        c[i] -= 1
        ans += c[i]
        
    print(ans)
    

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n, p = map(int, input().split())
    s = input()
    mu = [None]*n
    ans = 0
    c = [0]*p
    if 10%p == 0:
        ss = map(int, s)
        ss = list(ss)
        for i in range(n):
            if ss[i]%p == 0:
                ans += i+1
        print(ans)
        return
    sr = s[::-1]
    ssr = map(int, sr)
    tens = 1
    v = 0
    for i, si in enumerate(ssr):
        v = (v + (si%p)*tens)%p
        mu[i] = v
        c[v] += 1
        tens *= 10
        tens %= p
    c[0] += 1
    for i in c:
        if i:
            ans += ((i-1)*i)//2
        
    print(ans)
    

if __name__ == "__main__":
    main()
N=int(input())
P=[input().split() for i in range(N)]
print(c.most_common(P))

### FIXED CODE ###

n = int(input())
s = [input() for _ in range(n)]
d = {}
for w in s:
    if w not in d:
        d[w] = 0
    d[w] += 1
d2 = sorted(d.items(), key=lambda x:x[1], reverse=True)
maxcnts = [w[0] for w in d2 if w[1] == d2[0][1]]
maxcnts.sort()
for ans in maxcnts:
    print(ans)
import math
n,m = map(int,input().split())
a = list(map(lambda x: -int(x),input().split()))
print(a)
heapq.heapify(a)
for i in range(m):
    a_max = heapq.heappop(a)
    heapq.heappush(a,-(-a_max//2))
print(-sum(a))

### FIXED CODE ###

import math
import heapq
n,m = map(int,input().split())
a = list(map(lambda x: -int(x),input().split()))
heapq.heapify(a)
for i in range(m):
    a_max = heapq.heappop(a)
    heapq.heappush(a,-(-a_max//2))
print(-sum(a))
def Warshall_Floyd(d):
    #dist[i][j]:iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])
    return d
############################
n, m, l = map(int, input().split())

f_inf = float('inf')
dist = [[f_inf]*n for _ in range(n)]
for i in range(m):
    dist[i][i] = 0

for _ in range(m):
    a, b, c = map(int, input().split())
    dist[a-1][b-1] = min(dist[a-1][b-1], c)
    dist[b-1][a-1] = min(dist[b-1][a-1], c)

Warshall_Floyd(dist)

dist2 = [[f_inf]*n for _ in range(n)]
for i in range(n):
    for j in range(n):
        if dist[i][j] <= l:
            dist2[i][j] = 1

Warshall_Floyd(dist2)

q = int(input())
for _ in range(q):
    s, t = map(int, input().split())
    ans = dist2[s-1][t-1]-1
    if dist2[s-1][t-1] == f_inf:
      ans = -1
    print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N, M, L = map(int, input().split())
    dist = [[float('inf')] * N for _ in range(N)]
    for _ in range(M):
        A, B, C = map(int, input().split())
        if C > L:
            continue
        A -= 1
        B -= 1
        dist[A][B] = C
        dist[B][A] = C

    for k in range(N):
        for i in range(N):
            for j in range(N):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    e = [[float('inf')] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if dist[i][j] <= L:
                e[i][j] = 1
    
    for k in range(N):
        for i in range(N):
            for j in range(N):
                e[i][j] = min(e[i][j], e[i][k] + e[k][j])


    Q = int(input())
    for _ in range(Q):
        s, t = map(int, input().split())
        s -= 1
        t -= 1
        if e[s][t] == float('inf'):
            print(-1)
            continue
        ans = e[s][t]
        print(ans-1)


if __name__ == "__main__":
    main()
import math

r = int(raw_input())
l = math.pi*2*r
s = math.pi*r*r 
print'%f %f' % (s, l) 

### FIXED CODE ###

import math
r = float(raw_input())
l = math.pi*2*r
s = math.pi*r**2
print'%f %f' % (s, l)
N,K = map(int,input().split())
a = list(map(int,input().split()))
s = []
for i in range(N):
    total = 0
    for j in range(i,N):
        total += a[j]
        s.append(total)
s.sort(reverse=True)
n = 0
while s[0]>=2**n:
    n += 1
l,m = 0,2**n
for i in range(n)[::-1]:
    subs = list(filter(lambda x:x-(2**i)>=0,s))
    l = len(subs)
    if l>=K:
        s = subs[:]
    else:
        m //= 2
for i in range(n+1):
    subs = list(filter(lambda x:x%(2**m)==1,s))
    l = len(subs)
    if l>=K:
        s = subs[:]
        if l==K:
            break
    m //= 2
ans = s[0]
for i in range(1,K):
    ans &= s[i]
print(ans)


### FIXED CODE ###

N,K = map(int,input().split())
a = list(map(int,input().split()))
s = []
for i in range(N):
    total = 0
    for j in range(i,N):
        total += a[j]
        s.append(total)
s.sort(reverse=True)
m,n = 1,1
while s[0]>=m:
    n += 1
    m *= 2
for i in range(n)[::-1]:
    t = list(filter(lambda x:x-m>=0,s))
    l = len(t)
    if l>=K:
        break
    else:
        m //= 2
n = i+1
for i in range(n):
    u = list(filter(lambda x:(x//m)%2==1,t))
    l = len(u)
    if l>=K:
        t = u[:]
        if l==K:
            break
    m //= 2
ans = t[0]
for i in range(1,K):
    ans &= t[i]
print(ans)
while True:
    n, m = map(int, raw_input().split())
    if n==0 and m==0:
        break
    b = [input() for i in xrange(n)]
    p = 0; ans = 0;
    for i in xrange(m):
        d = input()
        p += d
        if p>=n-1 or p+b[p]>=n-1:
            ans = i+1
            break
        p += b[p]
    print ans

### FIXED CODE ###

while True:
    n, m = map(int, raw_input().split())
    if n==0 and m==0:
        break
    b = [input() for i in xrange(n)]
    d = [input() for i in xrange(m)]
    p = 0; ans = 0;
    for i in xrange(m):
        p += d[i]
        if p>=n-1 or p+b[p]>=n-1:
            ans = i+1
            break
        p += b[p]
    print ans
import sys

def suicide(lis):
    if len(lis) == 1:
        print lis[0]
    pokakito = []
    for i in range(len(lis)-1):
        check = lis[i] + lis[i+1]
        one = int(str(check)[-1])
        pokakito.append(one)
    else:
        suicide(pokakito)

for line in sys.stdin:
    lis = [int(char) for char in line.rstrip()]
    suicide(lis)

### FIXED CODE ###

def suicide(lis):
    if len(lis) == 1:
        print lis[0]
        return
    pokakito = []
    for i in range(len(lis)-1):
        check = lis[i] + lis[i+1]
        one = int(str(check)[-1])
        pokakito.append(one)
    else:
        suicide(pokakito)

while True:
    try:
        lis = [int(char) for char in raw_input()]
        suicide(lis)
    except EOFError:
        break
N, A, B = map(int, input().rstrip().split())
if A + B == 0:
    ret = 0
else:
    ret = (N // (A + B) * A + ('b'*A + 'r'*B)[:(N % (A + B))].count('b'))
print(ret)


### FIXED CODE ###

N, A, B = map(int, input().rstrip().split())
if A == 0:
    ret = 0
elif A + B == 0:
    ret = 0
else:
    tmp1 = int(N / (A + B)) * A
    tmp2 = 0
    if A > N % (A + B):
        tmp2 = N % (A + B)
    else:
        tmp2 = A
    ret = tmp1 + tmp2
print(ret)
n.k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
for i in range(n-k):
    if t[k+a] == t[a]:
        t[k+a] = 0
xs = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x)

### FIXED CODE ###

n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = list(input())
for i in range(n-k):
    if t[k+i] == t[i]:
        t[k+i] = 0
x = t.count('r')*p+ t.count('s')*r+t.count('p')*s
print(x)
import numpy as np

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

A = np.arange(N)+L

if A[0] <= 0 and A[N] => 0:
    print(np.sum(A))
elif A[0] < 0 and A[N] < 0:
    print(np.sum(A)-A[N])
else:
    print(np.sum(A)-A[0])

### FIXED CODE ###

import numpy as np

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

A = np.arange(N)+L

if A[0] <= 0 and A[N-1] >= 0:
    print(np.sum(A))
elif A[0] < 0 and A[N-1] < 0:
    print(np.sum(A)-A[N-1])
else:
    print(np.sum(A)-A[0])
N=int(input("enter number")) 
even=0
odd=0
if N%2==0:
    even=N/2
    odd=N/2
elif N=0:
    even=1
    odd=1
else:
    even=N//2
    odd=(N//2) +1
Print(even*odd)
Comment in Mark

### FIXED CODE ###

k = int(input())
x = [i for i in range(1, k+1) if i & 1 == 0]
y = [i for i in range(1, k+1) if i & 1 == 1]
print(len(x)*len(y))
n,k = map(int, input().split())
s = []
for i in range(k):
  d = int(input())
  a = list(map(int, input()))
  s += a
print(n-len(set(s)))
  

### FIXED CODE ###

n,k = map(int, input().split())
s = []
for i in range(k):
  d = int(input())
  a = list(map(int, input().split()))
  s += a
print(n-len(set(s)))
s=int(input())
m=s//60
h=s//3600
print(h,m,s,sec=":")

### FIXED CODE ###

sec=int(input())
m=sec//60%60
h=sec//3600
s=sec%60
print(h,m,s,sep=":")
c1=input()
c2=input()
c2.reverse()
if c1==c2:
    print("YES")
else:
    print("No")

### FIXED CODE ###

c1=input()
c2=input()
c2_rev=c2[::-1]
if c1==c2_rev:
    print("YES")
else:
    print("NO")