Harryxun/stf_run huggingface dataset:
import numpy as np

S = input()
mod = 10**9 + 7
dp = np.zeros(13)
dp[0] = 1

M = np.zeros((13, 13))
for i in range(13):
    for d in range(10):
        M[i][(i * 10 + d) % 13] += 1

for i in range(len(S)):
    ndp = np.zeros(13)
    if S[i] == '?':
        ndp = np.matmul(dp, M)
    else:
        d = int(S[i])
        for j in range(13):
            ndp[(j * 10 + d) % 13] += dp[j]
    dp = np.mod(ndp, mod)

print(int(dp[5]))


### FIXED CODE ###

import numpy as np
 
s = input()
p = np.array([0]*13)
p[0] = 1
 
amari = [[0]*13 for _ in range(13)]
for j in range(10):
  for i in range(13):
    amari[i][(i*10+j)%13] += 1
M = np.array(amari)
 
for si in range(len(s)):
  a = np.array([0]*13)
  if s[si] == '?':
    a = np.dot(p,M)
  else:
    c = int(s[si])
    for i in range(13):
      a[(i*10+c)%13] += p[i]
  p = np.mod(a,1000000007)
print(p[5])
import math as mt
K = input().split(" ")
A = int(K[0])
B = int(K[1])
a = float(A*12.5)
t = float((A+1)*12.5)
t1 = mt.ceil(t)
b = B*10
a1 = mt.ceil(a)
A_data = []
B_data = []
for i in range(b,b+10):
    A_data.append(i)
for i in range(a1,a1+t1):
    B_data.append(i)
A_set = set(A_data)
B_set = set(B_data)
AB_set = A_set & B_set
if AB_set:
    P = min(AB_set)
    print(P)
else:
    print(-1)
    



### FIXED CODE ###

S = input()
if S == "AAA" or S =="BBB":
    print('No')
else:
    print('Yes')
def lcm(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = y-x,x
	return int(a*b/y)

N,M=map(int,input().split())
S=input()
T=input()
l=lcm(N,M)
p,q=l//N,l//M
print(l) if S[0::q]==T[0::p] else print('-1')


### FIXED CODE ###

def gcd(a,b):
	x,y = min(a,b), max(a,b)
	while x*y>0:
		x,y = min(x,y), max(x,y)
		x,y = y-x,x
	return y

N,M=map(int,input().split())
S=input()
T=input()
g=gcd(N,M)
p,q=M//g,N//g
print((N//g)*M) if S[0::q]==T[0::p] else print('-1')
import math

A, B =map(int, input().split())

print(A*B / gcd(A, B))   

### FIXED CODE ###

import math

A, B =map(int, input().split())

print(int(A*B / math.gcd(A, B)))
import sys
import heapq
input = sys.stdin.readline
N, M = map(int, input().split())
a = list(map(int, input().split()))
res = 0
if M == 0:
  if N == 1:
    print(0)
  elif N == 2:
    print(sum(a))
  else: print("Impossible")
  exit(0)
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.root = [-1] * (n + 1)
    self.rnk = [0] * (n + 1)

  def Find_Root(self, x):
    if self.root[x] < 0:
      return x
    else:
      self.root[x] = self.Find_Root(self.root[x])
      return self.root[x]

  def Unite(self, x, y):
    x = self.Find_Root(x)
    y = self.Find_Root(y)
    if x == y:
      return 
    elif self.rnk[x] > self.rnk[y]:
      self.root[x] += self.root[y]
      self.root[y] = x
    else:
      self.root[y] += self.root[x]
      self.root[x] = y
      if self.rnk[x] == self.rnk[y]:
        self.rnk[y] += 1

  def isSameGroup(self, x, y):
    return self.Find_Root(x) == self.Find_Root(y)

  def Count(self, x):
    return -self.root[self.Find_Root(x)]

uf = UnionFind(N - 1)
for _ in range(M):
  u, v = map(int, input().split())
  uf.Unite(u, v)
hs = [[] for _ in range(N + 1)]
for x in range(N):
  y = uf.Find_Root(x)
  heapq.heappush(hs[y], a[x])
#print(hs)
c = 0
t = []
for x in range(N):
  if len(hs[x]):
    c += 1
    res += heapq.heappop(hs[x])
    t += hs[x]
t.sort()
#print(c, t, hs, res)
if c == 1:
  print(0)
  exit(0)
for i in range(c - 2):
  if i >= c - 2:
    print("Impossible")
    exit(0)
  res += t[i]
print(res)

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, M = map(int, input().split())
a = list(map(int, input().split()))
if N == 1:
  print(0)
  exit(0)
if M == 0 and (N > 2):
  print("Impossible")
  exit(0)
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.root = [-1] * (n + 1)
    self.rnk = [0] * (n + 1)

  def Find_Root(self, x):
    if self.root[x] < 0:
      return x
    else:
      self.root[x] = self.Find_Root(self.root[x])
      return self.root[x]

  def Unite(self, x, y):
    x = self.Find_Root(x)
    y = self.Find_Root(y)
    if x == y:
      return 
    elif self.rnk[x] > self.rnk[y]:
      self.root[x] += self.root[y]
      self.root[y] = x
    else:
      self.root[y] += self.root[x]
      self.root[x] = y
      if self.rnk[x] == self.rnk[y]:
        self.rnk[y] += 1

  def isSameGroup(self, x, y):
    return self.Find_Root(x) == self.Find_Root(y)

  def Count(self, x):
    return -self.root[self.Find_Root(x)]
uf = UnionFind(N)
d = [[] for _ in range(N)]
for _ in range(M):
  u, v = map(int, input().split())
  uf.Unite(u, v)
for i in range(N):
  d[uf.Find_Root(i)].append(a[i])
res = 0
x = []
y = 0
for i in range(N):
  d[i].sort(reverse = True)
  if len(d[i]):
    res += d[i].pop()
    y += 1
  x += d[i]
if y == 1:
  print(0)
  exit(0)
x.sort()
for i in range((y - 1) * 2 - y):
  if i >= len(x):
    print("Impossible")
    exit(0)
  res += x[i]
print(res)
a,b=map(int,input().split())
if a==b:
  print('H')
else:
  print('D')

### FIXED CODE ###

a,b=map(str,input().split())
if a==b:
  print('H')
else:
  print('D')
N = int(input())
if N%2:
    print((N+1)/(2*N))
else:
    print(0.5)N = int(input())
if N%2:
    print((N+1)/(2*N))
else:
    print(0.5)

### FIXED CODE ###

N = int(input())
if N%2:
    print((N+1)/(2*N))
else:
    print(0.5)
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
ans = 0
p.sort()
q.sort()
r.sort()
for i in range(X):
    if p[-1] >= r[-1]:
        ans += p[-1]
        del p[-1:]
        
    else:
        ans += r[-1]
        del r[-1:]
         
for i in range(Y):
    if q[-1] >= r[-1]:
        ans += q[-1]
        del q[-1:]
        
    else:
        ans += r[-1]
        del r[-1:]
                   

print(ans)

### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

ans = p[:X]+q[:Y]+r[:X+Y]
ans.sort(reverse=True)
su = sum(ans[:X+Y])

print(su)
N, Y = map(int, input().split())

v = 0
def solve():
    for x in range(N+1):
        if Y // 10000 < x:
            return [-1,-1,-1]
        r = Y - 10000 * x
        for y in range(0, r // 5000 + 1):
            rr = r - 5000 * y
            z = rr // 1000
            if x + y + z == N:
                return [x, y, z]

print(' '.join(map(str, solve())))


### FIXED CODE ###

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

v = 0
def solve():
    for x in range(N+1):
        if Y // 10000 < x:
            return [-1,-1,-1]
        r = Y - 10000 * x
        for y in range(0, r // 5000 + 1):
            rr = r - 5000 * y
            z = rr // 1000
            if x + y + z == N:
                return [x, y, z]
    return [-1,-1,-1]

print(' '.join(map(str, solve())))
c1 = input()
c2 = input()

if c1.reverse() == c2:
  print('YES')
else:
  print('NO)

### FIXED CODE ###

c1 = input()
c2 = input()

if c1[2] + c1[1] + c1[0] == c2:
  print('YES')
else:
  print('NO')
N, K = map(int, input().split())
N = (N - K)
container = []
result = 0
for i in range(int(N)):
    result = abs(i - N)
    container.append(result)
print(container[-1])

### FIXED CODE ###

n, k = map(int, input().split())
if n==0 or k==1:
    print(0)
    exit()
elif n<k:
    print(min(n, abs(n-k)))
    exit()
elif n % k == 0:
    print(0)
    exit()
else:
    mx = n%k
print(min(abs(mx-k), mx))
n = int(input())
A = [int(a) for input() in range(n)]
for i in range(n):
  Ai = A
  Ai.pop(i)
  print(max(Ai))


### FIXED CODE ###

n = int(input())
A = [int(input()) for _ in range(n)]

sort = sorted(A)

max = sort[-1]
maxx = sort[-2]

for i in range(n):
  if max == A[i]:
    print(maxx)
  else:
    print(max)
if input().in('9'):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

if '9' in input():
  print("Yes")
else:
  print("No")
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

n, cc = getMN()
jikan = [0 for i in range(10001)]
for i in range(n):
    s, t, c = getlist()
    jikan[s] += 1
    jikan[t+1] -= 1

accum = [0]
for j in jikan:
    accum.append(accum[-1]+j)

print(max(accum))

### FIXED CODE ###

import sys
import math
import copy
import itertools
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def solve():
    n,C = getList()
    li = []

    start = [[0] * 100100 for i in range(31)]
    end = [[0] * 100100 for i in range(31)]
    pt = [0] * 100100

    for i in range(n):
        s, t, c = getList()
        start[c][s] += 1
        end[c][t] += 1
        pt[s] += 1
        pt[t+1] -= 1

    for i in range(100099):
        pt[i+1] += pt[i]

    ans = 0
    for i in range(100100):
        tmp = pt[i]
        for j in range(31):
            if start[j][i] and end[j][i]:
                tmp -= 1
        ans = max(ans, tmp)

    print(ans)






def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()
w,h,x,y,r=map(int,input().split())

a=x-r
ap=x+r

b=y-r
bp=y+r
if a>0 and ap<w and b>0 and bp<h :
	print(“Yes”)
else :
	print(“No”)


### FIXED CODE ###

w,h,x,y,r=map(int,input().split())

a=x-r
ap=x+r

b=y-r
bp=y+r
if a<0 or ap>w or b<0 or bp>h:
	print('No')
else:
	print('Yes')
x,y = int(input().split)
print((x-1)*(y-1))

### FIXED CODE ###

x,y = map(int, input().split())
print((x-1)*(y-1))
n,m=map(int,input().split())
r=[[] for x in range(n)]
for c in range(m):
    a,b=map(int,input().split())
    r[a-1].append(b-1)
    r[b-1].append(a-1)
s=[-1]*n
u=[0]
k=1
for c in range(10**5):
  	v=[]
    for d in u:
        for e in r[d]:
            if s[e]==-1:
                s[e]=d
                k+=1
                v.append(e)
    if k>n-1:
        break
    u=v
print('Yes')
for c in range(n-1):
    print(s[c+1]+1)

### FIXED CODE ###

n,m=map(int,input().split())
g=[[] for x in range(n)]
for c in range(m):
    a,b= map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

ans_list=[-1]*n

queue=[0]

while queue:
    qi=queue.pop(0)
    for gi in g[qi]:
        if ans_list[gi]==-1:
            queue.append(gi)
            ans_list[gi]=qi

print("Yes")
for ans in ans_list[1:]:
    print(ans+1)
K = int(input())
S = input()
if int(len(S)) <= K:
    print(S)
else:
    print(S[0:K]...)


### FIXED CODE ###

K = int(input())
S = input()
if int(len(S)) <= K:
    print(S)
else:
    print(S[0:K]+'...')
def resolve():
    n, a, b = map(int, input().split())
    arr = ""
    while True:
        arr += "b"*a
        if len(arr) >= n:
            break
        arr+= "r"*b
        if len(arr) >= n:
            break
    print(arr[0:n].count("b"))


if __name__ == "__main__":
    resolve()

### FIXED CODE ###

def resolve():
    n,a,b = map(int, input().split())
    if a ==0:
        print(0)
    else:
        ans=0
        tmp = n //(a+b)
        ans += a*tmp
        if n - (a+b)*tmp >a :
            ans +=a
        else:
            ans += n - (a+b)*tmp
        
        print(ans)

if __name__ == "__main__":
    resolve()
n, k = map( int, input().split())
hate = set( input().split())

usable = sorted( list( {str(i) for i in range(10)} - hate))

l = len(str(n))

def check(l):
    num = []
    if l == 1:
        for i in usable:
            num.append(i)
    if l == 2:
        for ii in usable:
            for i in usable:
                num.append(int( str(ii) + str(i)))
    elif l == 3:
        for iii in usable:
            for ii in usable:
                for i in usable:
                    num.append(int( str(iii) + str(ii) + str(i)))
    elif l == 4:
        for iv in usable:
            for iii in usable:
                for ii in usable:
                    for i in usable:
                        num.append(int( str(iv) + str(iii) + str(ii) + str(i)))
    else:
        for v in usable:
            for iv in usable:
                for iii in usable:
                    for ii in usable:
                        for i in usable:
                            num.append(int( str(v) + str(iv) + str(iii) + str(ii) + str(i)))
    return num

truf = False
num = check(l)
for i in num:
    if n <= i:
        print(i)
        truf = True
        break
if not truf:
    num = check(l+1)
    for i in num:
        if n <= i:
            print(i)
            break

### FIXED CODE ###

n, k = map( int, input().split())
hate = set( input().split())

usable = sorted( list( {str(i) for i in range(10)} - hate))

l = len(str(n))

def check(l):
    num = []
    if l == 1:
        for i in usable:
            num.append(int(i))
    elif l == 2:
        for ii in usable:
            for i in usable:
                num.append(int( ii + i))
    elif l == 3:
        for iii in usable:
            for ii in usable:
                for i in usable:
                    num.append(int( iii + ii + i))
    elif l == 4:
        for iv in usable:
            for iii in usable:
                for ii in usable:
                    for i in usable:
                        num.append(int( iv + iii + ii + i))
    else:
        for v in usable:
            for iv in usable:
                for iii in usable:
                    for ii in usable:
                        for i in usable:
                            num.append(int( str(v) + str(iv) + str(iii) + str(ii) + str(i)))
    return num

truf = False
num = check(l)
for i in num:
    if n <= i:
        print(i)
        truf = True
        break
if not truf:
    num = check(l+1)
    for i in num:
        if n <= i:
            print(i)
            break
import sys

argNum = sys.argv[1]
print(argNum*argNum*argNum)

### FIXED CODE ###

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

import math

def main():
  N = float(input())
  print(int(math.pow(N,3)))

if __name__ == '__main__':
  main()
import itertools

N = int(input())
P = []
ans = 0

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

for YN in itertools.product([1,0], repeat = N):
  s = sum(YN)
  for j in range(len(YN)):
    if YN(j) == 1:
      for k in P[j]:
        if YN(k[0]) != k[1]:
          s = 0
          break
  ans = max(ans, s)

print(ans)

### FIXED CODE ###

#C

N = int(input())
P = []
ans = 0

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

#全探索
for i in range(2**N):
  Flag = True
  for j in range(N): #N人の〇×を順に見る
    
    if (i >> j) & 1 == 1: #j桁目が1、つまりj番目が正直者→チェック
      for YN in P[j]:
        if (i >> YN[0]) & 1 != YN[1]:
          Flag = False
          break

    if Flag:
      continue
    else:
      break

  if Flag:
    ans = max(ans, bin(i).count("1"))

print(ans)
import math

def main():
    s = input()
    k = int(input())
    cnt = 0
    if (len(s) == 1):
        cnt = math.floor(k/2)
    elif (len(s) == 2):
        if (s[0] == s[1]):
            cnt = k
        elif (s[0] != s[1]):
            cnt = 0
    else:
        l = list()
        prev = ''
        for c in s:
            if(c == prev):
                l[-1][1] += 1
            else:
                l.append([c, 1])
                prev = c
        for e in l:
            cnt += math.floor(e[1]/2)
        if (l[0][0] == l[-1][0]):
            p = l.pop()
            l[0][1] += p[1]
        cnt *= k
    print(cnt, end='')


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math

def main():
    s = input()
    k = int(input())
    cnt = 0
    if (len(s) == 0):
        cnt = 0
    elif (len(s) == 1):
        cnt = math.floor(k/2)
    elif (len(s) == 2):
        if (s[0] == s[1]):
            cnt = k
        elif (s[0] != s[1]):
            cnt = 0
    else:
        l = list()
        prev = ''
        for c in s:
            if(c == prev):
                l[-1][1] += 1
            else:
                l.append([c, 1])
                prev = c
        if (len(l) == 1):
            cnt += l[0][-1] * k // 2
        elif (len(l) == 2):
            cnt += l[0][-1] // 2
            cnt += l[1][-1] // 2
            cnt *= k
        else:
            edge1 = l[0]
            edge2 = l[-1]
            mid = l[1:-1]
            for e in mid:
                cnt += e[1] // 2 * k
            if (edge1[0] == edge2[0]):
                cnt += (edge1[1] + edge2[1]) // 2 * (k-1)
            else:
                cnt += (edge1[1]) // 2 * (k-1)
                cnt += (edge2[1]) // 2 * (k-1)
            cnt += edge1[1] // 2
            cnt += edge2[1] // 2

    print(cnt, end='')


if __name__ == '__main__':
    main()
n, a, b = map(int, input().split())
total = 0
for i in range(1, n+1):
  total_digit = 0
  j = i
  while j > 0:
    total_digit += j % 10
    j //= 10
    if j == 0:
      if total_digit >= a and total_digit <= b:
        total += i
print(total)

### FIXED CODE ###

import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    a, b, c, d = (int(x) for x in sys.stdin.read().split())
    left = a + b
    right = c + d
    if left > right: ans = "Left"
    elif right > left: ans = 'Right'
    else: ans = 'Balanced'
    print(ans)


if __name__ == "__main__":
    # execute only if run as a script
    main()
R = int(input())
en = 2 * R 3.14
print(en)

### FIXED CODE ###

# coding: utf-8
# Your code here!
import math
R = int(input())
en = 2 * math.pi * R
print(en)
print(input()**3)


### FIXED CODE ###

i=int(input())
print(i**3)
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = sum(b)
for i in range(len(a)-1):
    if a[i+1] - a[i] == 1:
        if a[i] == 1:
            ans += c[0]
        else:
            ans += c[i+1]
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = sum(b)
for i in range(len(a)-1):
    if a[i+1] - a[i] == 1:
        ans += c[a[i]-1]
print(ans)
d, e = map(int, f.readline().strip().split())
g = list(map(int, f.readline().strip().split()))
#print(d, e)
#print(g)
total = 0
for i in g:
    if i >= e:
        total += 1
print(total)

### FIXED CODE ###

N = int(input())
odd = 0
for i in range(1, N + 1):
    if i % 2 != 0:
        odd += 1
print(odd / N)
n, a, b = map(int, input().split())
mod = 10**9 + 7
ans = 0

f = 1
for i in range(1, n+1):
  f *= i
  f %= mod
     
# n!^-1 の計算
inv = pow(f, mod - 2, mod)
# n!^-1 - 1!^-1 の計算
invs = [1] * (n + 1)
invs[n] = inv
for m in range(n, 1, -1):
    inv *= m
    inv %= mod
    invs[m - 1] = inv

def comb(n,k):
  if k==0 or k==n: return 1
  return (f*invs[k]*invs[n-k])%mod

for i in range(1, n+1):
    if i != a and i != b:
        ans += (comb(n, i))
print(ans)

### FIXED CODE ###

# import sys
# sys.setrecursionlimit(10000)

N, K = map(int, input().split())
mod = 10**9 + 7
# def cmb(n, r):
#     if n - r < r: r = n - r
#     if r == 0: return 1
#     if r == 1: return n

#     numerator = [n - r + k + 1 for k in range(r)]
#     denominator = [k + 1 for k in range(r)]

#     for p in range(2,r+1):
#         pivot = denominator[p - 1]
#         if pivot > 1:
#             offset = (n - r) % p
#             for k in range(p-1,r,p):
#                 numerator[k - offset] /= pivot
#                 denominator[k] /= pivot

#     result = 1
#     for k in range(r):
#         if numerator[k] > 1:
#             result *= int(numerator[k])

#     return result


def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


for i in range(1, K+1):
    # print(cmb(N-K+1, i) , cmb(K-1, i-1))
    ans = cmb(N-K+1, i, mod) * cmb(K-1, i-1, mod) % mod
    print(ans)
n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]
x1, y1, h1 = XYH[0]
# print(x1, y1, h1)

for Cx in range(101):
    for Cy in range(101):
        H = h1 + abs(x1-Cx) + abs(y1-Cy)
        # print(Cx, Cy, H)
        if all(h == max(H-abs(x-Cx)-abs(y-Cy), 0) for x, y, h in XYH:
            print(Cx, Cy, H)
            exit()





### FIXED CODE ###

n = int(input())
XYH = [list(map(int, input().split())) for _ in range(n)]
#print(XYH)

for x1, y1, h1 in XYH:
    if h1 > 0:
        for Cx in range(101):
            for Cy in range(101):
                H = h1 + abs(x1 - Cx) + abs(y1 - Cy)
                # print(Cx, Cy, H)
                if all(h == max(H - abs(x - Cx) - abs(y - Cy), 0) for x, y, h in XYH):
                  print(Cx, Cy, H)
                  exit()
size, jumps = map(int, input().split())
array =  list(map(int, input().split()))
dp = [0]* size
dp[1]=  dp[0] + abs(array[1] - array[0]) 
for i in range(1,size):
	for j in range(jumps):		
		dp[i] = min( 
		dp[j],abs(array[i] - array[j])
		
		)
print(dp[-1])
		


### FIXED CODE ###

import sys


def input():
    return sys.stdin.readline().strip()


def main():
    size, jumps = map(int, input().split())
    array = list(map(int, input().split()))
    dp = [999999999] * size
    dp[0]= 0
    dp[1] = abs(array[0]- array[1])
    for i in range(2,size):
        dp[i] = min(abs(array[i] - array[j]) + dp[j] for j in range(max(0, i - jumps), i))
    print(dp[size-1])

if __name__ == "__main__":
    main()
n,k=map(int, input("").split(' '))
s=input('')
if len(s)=n:
  slist=lis((s))
  swapcase(slist[k-1])
 
for i in range(0,len(slist)-1):
  print(slist[i], end=' ')
  

### FIXED CODE ###

n,k=map(int, input("").split(' '))
assert n>=k>=1
assert 1<=n<=50

s=input('')
assert ("a","b","c" in s)

z=list((s))
z[k-1]=z[k-1].swapcase()

for i in z:
    print(i, end='')
s = input()
for i in range(len(s)):
  s[i] = 'x'
print(s)  

### FIXED CODE ###

s = input()
print("x"*len(s))
# coding: utf-8
from scipy.sparse.csgraph import floyd_warshall,csgraph_from_dense

MAX=pow(10,9) * 300
N,M,L=map(int, input().split())
Roads = [[ 0 if i == j else MAX for j in range(N)] for i in range(N)]

for i in range(M):
    f,t,c = map(int, input().split())
    Roads[f-1][t-1] = c
    Roads[t-1][f-1] = c

RG = csgraph_from_dense(Roads, null_value=MAX)
Rd = floyd_warshall(RG)

Fuels = [[ 1 if Rd[i][j] <=L else MAX for j in range(N)] for i in range(N)]

FG = csgraph_from_dense(Fuels, null_value=MAX)
Fd = floyd_warshall(FG)

Q=int(input())
Queries = []
for i in range(Q):
    s, t = map(int, input().split())
    v = Fd[s-1][t-1]
    if v == float('inf'):
        print (str(-1))
    else:
        print (str(int(v -1)))



### FIXED CODE ###

# coding: utf-8
from scipy.sparse.csgraph import floyd_warshall

N,M,L=map(int, input().split())
RG=[[0 for i in range(N)] for j in range(N)]

for i in range(M):
    f,t,c = map(int, input().split())
    if c <= L:
        RG[f-1][t-1] = c
        RG[t-1][f-1] = c

Rd = floyd_warshall(RG, directed=False)

FG=[[0 for i in range(N)] for j in range(N)]
for i in range(N):
    for j in range(i+1, N):
        if Rd[i][j] <= L:
            FG[i][j] = 1
            FG[j][i] = 1

Fd = floyd_warshall(FG, directed=False)

Q=int(input())
for i in range(Q):
    s, t = map(int, input().split())
    v = Fd[s-1][t-1]
    if s == t:
        print (str(0))
    if v == float('inf'):
        print (str(-1))
    else:
        print (str(int(v-1)))
a = input()
b = input()
c = input()
if a < b and b < c:
  print 'No'
elif a < c and c < b:
  print 'Yes'
elif b < c and c < a:
  print 'Yes'
elif b < a and a < c:
  print 'No'
elif c < a and a < b:
  print 'Yes'
elif c < b and b < a:
  print 'No'

### FIXED CODE ###

a, b, c = input().split()
if (int(a) < int(c) and int(c) < int(b)) or (int(b) < int(c) and int(c) < int(a)):
  print('Yes')
else:
  print('No')