Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

H, W = map(int, input().split())
S = []
for _ in range(H):
    s1 = input()
    S.append(s1)

ans = 1
d = [[1, 0], [-1, 0], [0, 1], [0, -1]]
for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            continue
        cnt = 1
        for dy, dx in d:
            y = i + dy
            x = j + dx
            while 0 <= y < H and 0 <= x < W and S[y][x] == ".":
                cnt += 1
                y += dy
                x += dx
        ans = max(ans, cnt)

print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
S = []
for _ in range(H):
    s1 = input()
    S.append(s1)

L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
U = [[0] * W for _ in range(H)]
D = [[0] * W for _ in range(H)]
for i in range(W):
    if S[0][i] == ".":
        U[0][i] = 1
    if S[H-1][i] == ".":
        D[H-1][i] = 1

for i in range(H):
    if S[i][0] == ".":
        L[i][0] = 1
    if S[i][W-1] == ".":
        R[i][W-1] = 1
     
for i in range(1,H):
    for j in range(W):
        if S[i][j] == "#":
            continue
        U[i][j] = U[i-1][j] + 1
for i in range(H-1)[::-1]:
    for j in range(W):
        if S[i][j] == "#":
            continue
        D[i][j] = D[i+1][j] + 1
for i in range(H):
    for j in range(1,W):
        if S[i][j] == "#":
            continue
        L[i][j] = L[i][j-1] + 1
for i in range(H):
    for j in range(W-1)[::-1]:
        if S[i][j] == "#":
            continue
        R[i][j] = R[i][j+1] + 1
        
ans = 0

for i in range(H):
    for j in range(W):
        ans = max(ans, U[i][j] + D[i][j] + L[i][j] + R[i][j] - 3)
print(ans)
### BUGGY CODE ###

from heapq import heappush,heappop

N,M,s,t=map(int,input().split())
table=[[] for i in range(N)]
rtable=[[] for i in range(N)]
for i in range(M):
    u,v,a,b=map(int,input().split())
    table[u-1].append([a,v-1])
    table[v-1].append([a,u-1])
    rtable[u-1].append([b,v-1])
    rtable[v-1].append([b,u-1])
mod=pow(10,15)
def dijk(s,table):
    dij=[]
    heappush(dij,[0,s])
    val=[mod]*N
    val[s]=0
    while dij:
        q,x=heappop(dij)
        if val[x]<q:
            continue
        for d,y in table[x]:
            if val[y]>val[x]+d:
                val[y]=val[x]+d
                heappush(dij,[val[y],y])
    return val
val=dijk(s-1,table)
rval=dijk(t-1,rtable)
score=[0]*N
for i in range(N):
    score[i]=mod-(val[i]+rval[i])
amax=[mod]*N
amax[-1]=score[-1]
for i in range(N-2,-1,-1):
    amax[i]=max(amax[i+1],score[i])
for i in range(N):
    print(amax[i])

### FIXED CODE ###

from heapq import heappush,heappop
from collections import deque
N,M,s,t=map(int,input().split())
table=[[] for i in range(N)]
rtable=[[] for i in range(N)]
for i in range(M):
    u,v,a,b=map(int,input().split())
    table[u-1].append([a,v-1])
    table[v-1].append([a,u-1])
    rtable[u-1].append([b,v-1])
    rtable[v-1].append([b,u-1])
dij=[]
heappush(dij,[0,s-1])
val=[10**16]*N
val[s-1]=0
while dij:
    q,x=heappop(dij)
    if val[x]<q:
        continue
    for d,y in table[x]:
        if val[y]>val[x]+d:
            val[y]=val[x]+d
            heappush(dij,[val[y],y])
rdij=[]
heappush(rdij,[0,t-1])
rval=[10**16]*N
rval[t-1]=0
while rdij:
    q,x=heappop(rdij)
    if rval[x]<q:
        continue
    for d,y in rtable[x]:
        if rval[y]>rval[x]+d:
            rval[y]=rval[x]+d
            heappush(rdij,[rval[y],y])
ans=deque()
t=val[N-1]+rval[N-1]
mod=pow(10,15)
ans.append(mod-t)
for i in range(N-2,-1,-1):
    t=min(t,val[i]+rval[i])
    ans.appendleft(mod-t)
print('\n'.join(map(str,ans)))
### BUGGY CODE ###

def tranpose(arr):
    return [list(i) for i in zip(*arr)]


def set_values(marr, harr):
    for i in range(len(harr)):
        value = 0
        for j in range(len(harr[i])):
            if marr[i][j]:
                value += 1
                harr[i][j] = value
            else:
                value = 0

    for i in range(len(harr)):
        for j in range(len(harr[i]) - 2, -1, -1):
            if marr[i][j]:
                harr[i][j] = max(harr[i][j], harr[i][j+1])


def solve():
    h, w = [int(x) for x in input().split()]
    marr = []
    harr = []
    varr = []

    for i in range(h):
        line = str(input())
        marr.append([True] * w)
        harr.append([0] * w)
        varr.append([0] * w)

        for j in range(w):
            if line[j] == '#':
                marr[i][j] = False

    set_values(marr, harr)

    t_marr = tranpose(marr)
    t_varr = tranpose(varr)
    set_values(t_marr, t_varr)
    varr = tranpose(t_varr)

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, harr[i][j] + varr[i][j])

    print(ans - 1)


if __name__ == '__main__':
    solve()



### FIXED CODE ###

import numpy as np
from pprint import pprint


def solve(MM, H, W):

    L, R, U, D = np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int)

    for i in range(H):
        i_r = H - 1 - i

        # L, U
        for j in range(W):
            j_r = W - 1 - j

            # L
            if MM[i][j]:
                if j == 0:
                    L[i][j] = 1
                else:
                    L[i][j] = L[i][j - 1] + 1

            # R
            if MM[i][j_r]:
                if j_r == W - 1:
                    R[i][j_r] = 1
                else:
                    R[i][j_r] = R[i][j_r + 1] + 1

            # U
            if MM[i][j]:
                if i == 0:
                    U[i][j] = 1
                else:
                    U[i][j] = U[i - 1][j] + 1

            # D
            if MM[i_r][j]:
                if i_r == H - 1:
                    D[i_r][j] = 1
                else:
                    D[i_r][j] = D[i_r + 1][j] + 1

    print((L + R + U + D - 3).max())


def solve2(MM, H, W):
    L, R, U, D = [MM.copy() for _ in range(4)]

    # U, D
    for i in range(1, H):
        U[i] = (U[i - 1] + 1) * MM[i]
        i_r = H - 1 - i
        D[i_r] = (D[i_r + 1] + 1) * MM[i_r]

    MM_T = MM.T
    L_T, R_T = L.T, R.T

    # L, R
    for i in range(1, W):
        L_T[i] = (L_T[i - 1] + 1) * MM_T[i]
        i_r = W - 1 - i
        R_T[i_r] = (R_T[i_r + 1] + 1) * MM_T[i_r]

    L, R = L_T.T, R_T.T
    print((L + R + U + D).max() - 3)


def stdin():
    H, W = [int(x) for x in input().split()]
    MM = np.zeros((H, W), dtype=int)

    for i in range(H):
        line = str(input())

        for j in range(W):
            if line[j] != '#':
                MM[i][j] = 1

    solve2(MM, H, W)


if __name__ == '__main__':
    stdin()
### BUGGY CODE ###

def test(x):
  num = 2
  s = []
  while x != 1:
    if(x % num == 0):
      x = x / num
      s.append(num)
    else:
      num += 1

  return set(s)

def main():
  import math

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

  num = []

  num = list(test(a) & test(b))
  num.append(1)
  print(len(num))

if __name__ == '__main__':
  main()


### FIXED CODE ###

from fractions import gcd
import math

def test(a,b):
  x = gcd(a,b)
  s = []
  for i in range(2, int(math.sqrt(x)) + 1):
    while x % i == 0:
      s.append(i)
      x //= i

  s.append(x)
  s.append(1)

  return list(set(s))

def main():

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

  num = []

  num = test(a, b)
  print(len(num))

if __name__ == '__main__':
  main()
### BUGGY CODE ###

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


def cf(x1, x2):
    ret = [1]
    gcd_num = gcd(x1, x2)

    i = 2
    while i <= gcd_num:
        if gcd_num % i == 0:
            ret.append(i)
        i += 1

    return ret


def is_prime_number(num):
    if num == 1:
        return False

    i = 2
    while i*i <= num:
        if num % i == 0:
            return False
        i += 1
    return True


def main():
    a, b = map(int, input().split())
    common_divisor_list = cf(a, b)
    # print(common_divisor_list)

    count = 0
    for num in common_divisor_list:
        if is_prime_number(num):
            count += 1

    print(count + 1)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


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


def main():
    a, b = map(int, input().split())
    gcd_num = gcd(a, b)
    c = collections.Counter(prime_factorize(gcd_num))
    # print(prime_factorize(gcd_num))
    # cには１が含まれていないので、その分カウントを増やす
    print(len(c) + 1)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

from math import gcd

k = int(input())
ans = 0

a = [(i+1,j+1,l+1) for i in range(k) for j in range(k) for l in range(k)]

for i in a:
  ans += (gcd(gcd(i[0],i[1]),i[2]))


print(ans)

### FIXED CODE ###

from math import gcd



k = int(input())
ans = 0

temp = []
for i in range(1,k+1):
  for j in range(1,k+1):
    temp.append(gcd(i,j))

import collections
c = collections.Counter(temp)

for i in range(1,k+1):
  for j in c.keys():
    ans += gcd(i,j) * c[j]

print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
As = list(map(int, input().rstrip().split()))


def gcd_list(cur_gcd, numbers):
    res = cur_gcd
    for idx in range(len(numbers)):
        res = fractions.gcd(res, numbers[idx])
    return res


max_gcd = 0
if(N) == 2:
    max_gcd = max(As)
else:
    # i == 0
    others = [As[j] for j in range(1, N)]
    res = fractions.gcd(others[0], others[1])
    if len(others) > 2:
        res = gcd_list(res, As[2:])
    max_gcd = res
    tmp_gcd = As[0]

    # i >= 1
    for i in range(1, N):
        others = [As[j] for j in range(N) if j > i]
        max_gcd = max(gcd_list(tmp_gcd, others), max_gcd)
        tmp_gcd = fractions.gcd(tmp_gcd, As[i])

print(max_gcd)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import fractions

N = int(input().rstrip())
A = [0] + list(map(int, input().rstrip().split())) + [0]

L = [0] * (N + 2)
R = [0] * (N + 2)

for i in range(0, N):
    L[i + 1] = fractions.gcd(L[i], A[i + 1])

for i in range(N, 0, -1):
    R[i] = fractions.gcd(R[i + 1], A[i])

print(max(fractions.gcd(L[i], R[i + 2]) for i in range(0, N)))
### BUGGY CODE ###

from collections import deque
N = int(input())

d = deque([0])
table = [-1]*(N+1)
table[0] = 0
while d:
    i = d.popleft()
    j = 6
    k = 9
    if (i < N):
        if table[i+1] == -1:
            table[i+1] = table[i] + 1
        d.append(i+1)

    while i + j <= N:
        if table[i+j] == -1:
            table[i+j] = table[i] + 1
            d.append(j)
        j *= 6
    while i + k <= N:
        if table[i+k] == -1:
            table[i+k] = table[i] + 1
            d.append(k)
        k *= 9
print(table[N])            

### FIXED CODE ###

N = int(input())
dp = [0] * (N+1)
for i in range(1,N+1):
    dp[i] = float('inf')
    power = 1
    while power <= i:
        dp[i] = min(dp[i], dp[i-power] +1)
        power *= 6
    power = 9
    while power <= i:
        dp[i] = min(dp[i], dp[i-power] + 1)
        power *= 9
print(dp[N])
### BUGGY CODE ###


a = [input(),input(),input()]
l = [len(a[0]),len(a[1]),len(a[2])]
full = l[0]+l[1]+l[2]
b = ['?']*full

def permList(s):
    p = []
    l = len(s)
    if not l:
        return [[]]
    for i in range(l):
        for post in permList(s[:i]+s[i+1:]):
            p.append([s[i]]+post)
    return p
comb = permList([0,1,2])

def check(stt0, a0, l0, stt1, a1, l1):
    i = stt1 - stt0
    j = 0
    while i<l0 and j<l1:
        if a0[i] != a1[j]:
            if a0[i] != '?' and a1[j] != '?':
                return False
        i += 1
        j += 1
    return True

ans = l[0]+l[1]+l[2]
for i,j,k in comb:
    a0, a1, a2 = a[i],a[j],a[k]
    l0, l1, l2 = l[i],l[j],l[k]
    stt0 = 0
    for stt1 in range(0,l0+1):
        if not check(stt0,a0,l0, stt1,a1,l1):
            continue
        l01 = max(l0,stt1+l1)
        for stt2 in range(stt1,l01+1):
            if not check(stt1,a1,l1, stt2,a2,l2):
                continue
            if not check(stt0,a0,l0, stt2,a2,l2):
                continue
            l012 = max(l01,stt2+l2)
            ans = min(ans,l012)
print(ans)

### FIXED CODE ###

a = [input(),input(),input()]
l = [len(a[0]),len(a[1]),len(a[2])]
ans = l[0]+l[1]+l[2]

def check(a0, l0, a1, l1, delta):
    # stt1 >= stt0, stt1 - stt0 >=l0 must return True
    i = delta
    j = 0
    while (i<l0) and (j<l1):
        if a0[i] != a1[j]:
            if a0[i] != '?' and a1[j] != '?':
                return False
        i += 1
        j += 1
    return True

memoLen = ans-min(l[0],l[1],l[2])+1
memo = [[[1]*memoLen for i in range(3)] for j in range(3)]
comb2 = [(0,1),(1,0),(1,2),(2,1),(0,2),(2,0)]
for x, y in comb2:
    me = memo[x][y]
    a0, a1 = a[x],a[y]
    l0, l1 = l[x],l[y]
    for delta in range(0,l0):
        if not check(a0,l0, a1,l1, delta):
            me[delta] = 0

comb = [(0,1,2),(0,2,1),(1,0,2),(1,2,0),(2,1,0),(2,0,1)]
for i,j,k in comb:
    l0, l1, l2 = l[i],l[j],l[k]
    for stt1 in range(0,l0+1):
        if memo[i][j][stt1]:
            l01 = max(l0,stt1+l1)
            for stt2 in range(stt1,l01+1):
                if memo[j][k][stt2-stt1] and memo[i][k][stt2]:
                    l012 = max(l01,stt2+l2)
                    ans = min(ans,l012)
print(ans)
### BUGGY CODE ###

import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n, t = ril()
ls = rils(n)
ls.sort()

lim = t + 3001
values = [0] * lim
for a, b in ls:
    for j in reversed(range(lim - a)):
        if j < t:
            values[j + a] = max(values[j + a], values[j] + b)
print(max(values))


### FIXED CODE ###

import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]


def knapsack_01(items, weight_limit):
    values = [0] * (weight_limit + 1)
    for w, v in items:
        for j in reversed(range(w, weight_limit + 1)):
            values[j] = max(values[j], values[j - w] + v)
    return max(values)


n, t = ril()
ls = rils(n)

dp = [[0] * t for _ in range(n + 1)]
for i in range(n + 1):
    for tt in range(t):
        if i == 0 or tt == 0:
            continue
        elif ls[i - 1][0] <= tt:
            dp[i][tt] = max(dp[i - 1][tt],
                            dp[i - 1][tt - ls[i - 1][0]] + ls[i - 1][1])
        else:
            dp[i][tt] = dp[i - 1][tt]

val = dp[n][t - 1]

res = set()
tt = t - 1
for i in range(n, 0, -1):
    if val <= 0:
        break
    if val == dp[i - 1][tt]:
        continue
    else:
        res.add(i - 1)
        val = val - ls[i - 1][1]
        tt = tt - ls[i - 1][0]

remaining = [v for i, (_, v) in enumerate(ls) if i not in res]
print(dp[n][t - 1] + max(remaining) if len(remaining) else dp[n][t - 1])
### BUGGY CODE ###

n, x, y = map(int, input().split())
array = []

for i in range(1, n+1):
    for j in range(i+1, n+1):
        array.append(min(j-i, abs(x-i)+1+abs(y-j), abs(y-i)+1+abs(x-j)))

for k in range(1, n):
    print(array.count(k))

### FIXED CODE ###

n, x, y = map(int, input().split())
array = [0]*(n-1)

for i in range(1, n+1):
    for j in range(i+2, n+1):
        array[min(j-i, abs(x-i)+1+abs(y-j), abs(y-i)+1+abs(x-j))-1] += 1

print(n)
for k in range(1, n-1):
    print(array[k])
### BUGGY CODE ###

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

D = R - L
Ans = {2018}
J_Set = {2018}
def cal(a, b):
    return int((a*b)%2019)

for i in range(min(D, 2019)):
    A = (L+i)%2019
    for j in range(D-i):
        B = (L+i+j+1)%2019
        Ans.add((A*B)%2019)
        if j > 2019:
            break
        
print(min(Ans))

### FIXED CODE ###

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

D = R - L
Ans = {2018}
J_Set = {2018}


for i in range(min(D, 2019)):
    A = L+i
    for j in range(D-i):
        B = L+i+j+1
        Ans.add((A*B)%2019)
        if j > 2019:
            break

print(min(Ans))
### BUGGY CODE ###

N=int(input())
lst = [int(s) for s in input().split()]
ans=[0]*N
result=[]
def divls(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)
    return divisors
for i in range(N):
  n=N-1-i
  x=lst[n]
  y=ans[n]
  if(x!=y):
    result.append(n+1)
    divisors=divls(n+1)
    for j in range(len(divisors)):
      ans[divisors[j]-1]=1-ans[divisors[j]-1]
result.sort()
print(len(result))
if (len(result)!=0):
  print(' '.join(map(str, result)))

### FIXED CODE ###

N=int(input())
lst = [int(s) for s in input().split()]
ans=[0]*N
result=[]
def now(num):
  res=0
  k=1
  while(k*num<=N):
    res=res+ans[k*num-1]
    k=k+1
  return res%2
for i in range(N):
  n=N-i
  x=lst[n-1]
  y=now(n)
  if(x!=y):
    ans[n-1]=1
    result.append(n)
result.sort()
print(len(result))
if (len(result)!=0):
  print(' '.join(map(str, result)))
### BUGGY CODE ###

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

to = [[] for _ in range(N + 1)]
for _ in range(N - 1):
  a, b = map(int, input().split())
  to[a].append(b)
  to[b].append(a)

cnt = [0 for _ in range(N + 1)]
for _ in range(Q):
  p, x = map(int, input().split())
  cnt[p] += x

queue = [[1, 0]]
while len(queue) > 0:
  q = queue.pop(0)
  if q[0] != 0:
    cnt[q[0]] += cnt[q[1]]
  for i in to[q[0]]:
    if i != q[1]:
      queue.append([i, q[0]])

for i in range(1, N + 1):
  print(cnt[i])

### FIXED CODE ###

from collections import deque
n, Q = map(int, input().split())
edges = [[] for _ in range(n+1)]
count = [0]*(n+1)
q = deque()
q.append((1, 0))

for _ in range(n-1):
    a, b = map(int, input().split())
    edges[a].append(b)
    edges[b].append(a)
for _ in range(Q):
    p, x = map(int, input().split())
    count[p] += x

while(q):
    k = q.popleft()
    count[k[0]] += count[k[1]]
    for i in edges[k[0]]:
        if not i == k[1]:
            q.append((i, k[0]))

print(*count[1:])
### BUGGY CODE ###

from itertools import product
import numpy as np
H,W,K = list(map(int, input().split()))
A = []
for i in range(H):
  A.append(np.array(list(map(int, input()))))

#SM = [np.cumsum(A[i]) for i in range(H)]

ANS = []
for pat in product(['0','1'], repeat = H-1):
  res = []
  cnt = 0
  now = np.copy(A[0])
  for i in range(1,H):
    p = pat[i-1]
    if p == '1':
      res.append(now)
      now = np.copy(A[i])
      cnt += 1
    else:
      now += A[i]
  res.append(now)
  
  wk = [0 for _ in range(len(res))]
  for x in range(W):
    flg = True
    while flg:
      for j in range(len(res)):
        wk[j] += res[j][x]
      if max(wk) > K:
        cnt += 1
        flg = True
        wk = [0 for _ in range(len(res))]
      else:
        break
  ANS.append(cnt)
  
print(min(ANS))

### FIXED CODE ###

from itertools import product
import copy
H,W,K = list(map(int, input().split()))
A = []
for i in range(H):
  A.append(list(map(int, input())))

#SM = [np.cumsum(A[i]) for i in range(H)]

ANS = []
for pat in product(['0','1'], repeat = H-1):
  res = []
  cnt = 0
  now = copy.copy(A[0])
  for i in range(1,H):
    p = pat[i-1]
    if p == '1':
      res.append(now)
      now = copy.copy(A[i])
      cnt += 1
    else:
      for j in range(W):
        now[j] += A[i][j]
  res.append(now)
  
  """  
  print("---")
  print(pat)
  print(res)
  print(cnt)
  """  
  wk2 = [0] * len(res)
  cnt2 = 0
  flg = True
  for x in range(W):
    for j in range(len(res)):
      if res[j][x] > K:
        # 横に割った段階で、すでに最小単位がKを超えてたら実現不可能
        flg = False
        break
      if wk2[j] + res[j][x] > K:
        cnt2 += 1
        wk2 = [0] * len(res)
        break
    for j in range(len(res)):
      wk2[j] += res[j][x]
    if not flg:
      break
      
  if flg:
    ANS.append(cnt + cnt2)
    #print(pat, cnt, cnt2)
print(min(ANS))
### BUGGY CODE ###

n = int(input())
a_lst = [int(elem) for elem in input().split()]

keys = list(set(a_lst))
cnt = 0
for k in keys:
  if a_lst.count(k) > k:
    cnt += a_lst.count(k) - k
  elif a_lst.count(k) < k:
    cnt += a_lst.count(k)
print(cnt)

### FIXED CODE ###

import collections

n = int(input())
a_lst = [int(elem) for elem in input().split()]

c = collections.Counter(a_lst)
cnt = 0

for k in c.keys():
  if c[k] > k:
    cnt += c[k] - k
  elif c[k] < k:
    cnt += c[k]
print(cnt)
### BUGGY CODE ###

n,a,b=map(int,input().split())
mod=10**9+7
bunbo=1
bunshi=1
for i in range(1,max(a+1, b+1)):
    bunbo*=i
    bunshi*=n-i+1
    bunshi%=mod
    bunbo%=mod
    if i==a:
        comba=bunshi*(pow(bunbo,mod-2,mod))
    if i==b:
        combb=bunshi*(pow(bunbo,mod-2,mod))
print((2**n-1-comba-combb)%mod)

### FIXED CODE ###

n,a,b=map(int,input().split())
mod=10**9+7
bunbo=1
bunshi=1
for i in range(1,max(a+1, b+1)):
    bunbo*=i
    bunshi*=n-i+1
    bunshi%=mod
    bunbo%=mod
    if i==a:
        comba=bunshi*(pow(bunbo,mod-2,mod))
    if i==b:
        combb=bunshi*(pow(bunbo,mod-2,mod))
print((2**n-1-comba-combb)%mod)
### BUGGY CODE ###

n, k = map(int, input().split())
h_array = [int(x) for x in input().split()]
res = [0 for x in range(n)]
for index in range(n):
    ret = float("inf")
    if index == 1:
        res[index] = abs(h_array[index] - h_array[index - 1])
        continue
    elif index == 0:
        res[index] = 0
        continue
    for i in range(1, k + 1):
        if index - i < 0:
            continue
        ret = min(ret, abs(h_array[index] - h_array[index - i]) + res[index - i])
    res[index] = ret

print(res[-1])


### FIXED CODE ###

n, k = map(int, input().split())
h_array = [int(x) for x in input().split()]
res = [0 for x in range(n)]
for index in range(n):
    ret = float("inf")
    if index == 1:
        res[index] = abs(h_array[index] - h_array[index - 1])
        continue
    elif index == 0:
        res[index] = 0
        continue
    for i in range(1, k + 1):
        if index - i < 0:
            continue
        ret = min(ret, abs(h_array[index] - h_array[index - i]) + res[index - i])
    res[index] = ret

print(res[-1])