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

import numpy as np

inf = np.iinfo(np.uint32).max



def solve():
    dists_y = [abs(y-a) for a in range(0,n+1)]
    dists_x = [abs(x-a) for a in range(0,n+1)]
    count_dists = np.zeros(n+1, dtype=int)
    for a in range(1,n+1):
        for b in range(1,a+1):
            dis = min(abs(b-a), dists_x[a] + dists_y[b] + 1, dists_y[a] + dists_x[b] + 1)
            count_dists[dis] += 1
    #print(min_dists)
    for j in range(1,n):
        print(count_dists[j])


#
# def ceildiv(a, b):
#     return a // b + a % b



n, x, y = [int(i) for i in input().split(" ")]

# import time
# t = time.time()
# n, x, y = 2000, 600, 1200


solve()
#print(time.time()- t)

### FIXED CODE ###

import numpy as np

inf = np.iinfo(np.uint32).max



# def solve():
#     dists_y = [abs(y-a) for a in range(0,n+1)]
#     dists_x = [abs(x-a) for a in range(0,n+1)]
#     count_dists = np.zeros(n+1, dtype=int)
#     for a in range(1,n+1):
#         for b in range(1,a+1):
#             dis = min(abs(b-a), dists_x[a] + dists_y[b] + 1, dists_y[a] + dists_x[b] + 1)
#             count_dists[dis] += 1
#     #print(min_dists)
#     for j in range(1,n):
#         print(count_dists[j])

def solve():
    dists_y = [abs(y-a) for a in range(1,n+1)]
    dists_x = [abs(x-a) for a in range(1,n+1)]

    aa = np.tile(np.arange(1, n+1), (n, 1))
    bb = aa.transpose().copy()
    base_dists = np.abs(aa-bb).copy()
    aa = np.tile(dists_y, (n, 1))
    bb = np.tile(dists_x, (n, 1)).transpose().copy()
    ab_dists = aa + bb + 1
    ba_dists = ab_dists.transpose().copy()
    min_dists = np.minimum(ab_dists, ba_dists)
    min_dists = np.minimum(min_dists, base_dists)
    count_dists = np.bincount(min_dists.reshape(n**2))
    for j in range(1,n):
        if j+1>len(count_dists):
            print(0)
        else:
            print(count_dists[j]//2)



#
# def ceildiv(a, b):
#     return a // b + a % b



n, x, y = [int(i) for i in input().split(" ")]

# import time
# t = time.time()
# n, x, y = 2000, 200, 600


solve()
#print(time.time()- t)
### BUGGY CODE ###

N = int(input())
S = input()

S_set = {S[0:3]}
cnst = 0
for i in range(3,N):
    S_0_set = set()
    for s_0 in S_set:
        for j in range(len(s_0)):
            if s_0[0:j]+s_0[j+1:3]+S[i] not in S_set:
                S_0_set.add(s_0[0:j]+s_0[j+1:3]+S[i])
    S_set = S_set.union(S_0_set)
    if len(S_set) == 1000:
        print(1000)
        cnst = 1
        break
if cnst == 0:
    print(len(S_set))


### FIXED CODE ###

N = int(input())
S = input()

def judge(S,A): #A:3桁ｎ数字
    dig,pt = 0,0
    while dig < 3 and pt < N:
        if S[pt] == A[dig]:
            dig += 1
            pt += 1
        else:
            pt += 1
        if dig == 3:
            break

    if dig == 3:
        return True
    else:
        return False

count = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            if judge(S,[str(a),str(b),str(c)]):
                count += 1

print(count)
### BUGGY CODE ###

def main():
    import sys
    from fractions import gcd
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int, input().split()))
    mod = 1000000007

    X = A[0]
    for i in range(1, N):
        g = gcd(X, A[i])
        X = (X * A[i]) // g
    ans = 0
    for i in range(N):
        ans = (ans + X // A[i])%mod
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import sys
    from fractions import gcd
    from collections import defaultdict
    input = sys.stdin.buffer.readline

    def p(n):
        ret = defaultdict(int)
        d = 2
        m = int(n**0.5)
        while n > 1:
            if n % d == 0:
                ret[d] += 1
                n //= d
            else:
                d += 1
                if d > m:
                    ret[n] += 1
                    break
        return ret

    N = int(input())
    A = list(map(int, input().split()))
    mod = 1000000007

    prime = defaultdict(int)
    p_list = []
    for a in A:
        pp = p(a)
        p_list.append(pp)
        for pr in pp.keys():
            ppr = prime[pr]
            pppr = pp[pr]
            if ppr < pppr:
                prime[pr] = pppr

    M = 1
    for pr in prime.keys():
        M = (M * pow(pr, prime[pr], mod))%mod

    ans = 0
    for a in A:
        ans = (ans + (M * pow(a, mod-2, mod))%mod)%mod

    print(ans)


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

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

a = sorted(a)
b = sorted(b)
c = sorted(c)

ans = 0

for i in range(n):
    ans1 = 0
    ans2 = 0
    ok = -1
    ng = n
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if a[mid] < b[i] :
            ok = mid
        else:
            ng = mid
        if ng - ok == 1:
            ans1 += ok + 1
    ok = n
    ng = -1
    while abs(ng - ok) > 1:
        mid = (ok + ng) // 2
        if b[i] < c[mid]:
            ok = mid
        else:
            ng = mid
        if abs(ng - ok) == 1:
            ans2 += n - ok
    ans += ans1 * ans2
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()))

a = sorted(a)
b = sorted(b)
c = sorted(c)

ans = 0

for i in range(n):
    ans1 = 0
    ans2 = 0
    ok = -1
    ng = n
    while abs(ng - ok) > 1:
        mid = (ok + ng) // 2
        if a[mid] < b[i] :
            ok = mid
        else:
            ng = mid
        if abs(ng - ok) == 1:
            ans1 += ok + 1
    ok = n
    ng = -1
    while abs(ng - ok) > 1:
        mid = (ok + ng) // 2
        if b[i] < c[mid]:
            ok = mid
        else:
            ng = mid
        if abs(ng - ok) == 1:
            ans2 += n - ok
    ans += ans1 * ans2
print(ans)
### BUGGY CODE ###

N = int(input())
ans = [-1]*N
arr = []
for i in range(N-1):
    u,v,w = map(int,input().split())
    u -= 1
    v -= 1
    arr.append([u,v,w])
e_list = [[] for i in range(N)]
e_graph = [[0]*N for i in range(N)]
for u,v,w in arr:
    e_list[u].append(v)
    e_list[v].append(u)
    e_graph[u][v] = w
    e_graph[v][u] = w

stack = [0]
ans[0] = 0
while (stack):
    cur_pos = stack.pop()
    for des in e_list[cur_pos]:
        t = ans[des]
        if ans[des] < 0:
            if e_graph[cur_pos][des] %2 == 0:
                ans[des] = ans[cur_pos]
            else:
                ans[des] = (ans[cur_pos] + 1)%2
            stack.append(des)
for i in ans:
    print(i)

### FIXED CODE ###

import heapq as hp
N = int(input())
ans = [-1]*N
arr = []
for i in range(N-1):
    u,v,w = map(int,input().split())
    u -= 1
    v -= 1
    arr.append([u,v,w])
e_list = [[] for i in range(N)]
for u,v,w in arr:
    e_list[u].append([v,w])
    e_list[v].append([u,w])

stack = [0]
ans[0] = 0
while(stack):
    cur_pos = stack.pop()
    for des,cost in e_list[cur_pos]:
        if ans[des] >=  0:
            continue
        ans[des] = (ans[cur_pos] + cost)%2
        stack.append(des)
for i in ans:
    print(i)
### BUGGY CODE ###

count = int(input())

ls = []

for i in range(count):
    ls.append(input())

max = 0
ans = []

for s in set(ls):
    i = ls.count(s)
    if i >= max:
        if i > max:
            ans.clear()

        ans.append(s)
        max = i

print('\n'.join(sorted(ans)))

### FIXED CODE ###

count = int(input())

ls = {}

for i in range(count):
    s = input()
    if s in ls:
        ls[s] += ls[s] + 1
    else:
        ls.setdefault(s, 1)

m = max(ls.values())

ans = [k for k, v in ls.items() if v == m]

print('\n'.join(sorted(ans)))
### BUGGY CODE ###

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

id = [0] * (N+1)

for i in range(M):
    L, R = map(int, input().split())
    for j in range(L, R+1):
        id[j] += 1

cnt = 0
for i in range(1, N+1):
    if id[i] == M:
        cnt += 1

print(cnt)


### FIXED CODE ###

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

left = 1
right = N

for i in range(M):
    L, R = map(int, input().split())
    if L > left :
        left = L
    if R < right:
        right = R

if right-left+1 > 0:
    print(right-left+1)
else:
    print(0)
### BUGGY CODE ###

def comb(n):
    if n==1:return 0
    r=1
    for i in range(n,n-2,-1):
       r*=i
    return r//2
stdin =open(0).read().split('\n')
N=int(stdin[0])
A=list(map(int,stdin[1].split()))
ans=[0]*N
for i in range(N):
    A=list(map(int,stdin[1].split()))
    A.pop(i)
    for j in set(A):
        ans[i]+=comb(A.count(j))
    print(ans[i])

### FIXED CODE ###

stdin =open(0).read().split('\n')
N=int(stdin[0])
A=list(map(int,stdin[1].split()))
from collections import Counter
C=Counter(A)
ans=0
for i in C.values():
    ans+=i*(i-1)//2
for a in A:
    num = C[a]
    print(ans-num*(num-1)//2+(num-1)*(num-2)//2)
### BUGGY CODE ###

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

for i in range(N):
    s=input()
    if s in ans:
        pass
    else:
        ans.append(s)

print(len(ans))

### FIXED CODE ###

N=int(input())
l=[input() for i in range(N)]
k=sorted(l)
cnt=1

for i in range(N-1):
    if k[i]!=k[i+1]:
        cnt+=1

print(cnt)
### BUGGY CODE ###

a,b,n=map(int,input().strip().split())
t=0
for i in range(n+1):
    t=max(t,((a*i)//b)-(a*(i//b)))
print(t)
    

### FIXED CODE ###

a,b,n=map(int,input().strip().split())
t=0
if (b-1)<=n:
        t=(a*(b-1)//b)
else:
        t=(a*n)//b
    
   # t=max(t,((a*i)//b)-(a*(i//b)))
print(t)
### BUGGY CODE ###

N = int(input())
AB=[]
for _ in range(N):
    AB.append(tuple(map(int, input().split())))
#print(N, AB)

AB=sorted(AB, key=lambda val:val[1])
task=[]
for ab in AB:
    for _ in range(ab[0]):
        task.append(ab[1])
#print(AB)
#print(task)

for i in range(len(task)):
    if i+1>task[i]:
        print('No')
        break
else:
    print('Yes')

### FIXED CODE ###

N = int(input())
AB=[]
for _ in range(N):
    AB.append(list(map(int, input().split())))
#print(N, AB)

AB=sorted(AB, key=lambda val:val[1])

if AB[0][0]>AB[0][1]:
    print('No')
else:
    for i in range(N-1):
        AB[i+1][0]+=AB[i][0]
        if AB[i+1][0]>AB[i+1][1]:
            print('No')
            break
    else:
        print('Yes')
### BUGGY CODE ###

N,M,K=map(int, input().split())
par=list(range(N))
nums=[0 for _ in range(N)]
rank=[0 for _ in range(N)]
#実装
def find(x):
    if par[x]==x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
def unite(x,y):
    x=find(x)
    y=find(y)
    if x==y:
        return
    if rank[x]<rank[y]:
        par[x]=y
    else:
        par[y]=x
        if rank[x]==rank[y]:
            rank[x]+=1
def same(x,y):
    return find(x)==find(y)

checked=[]

for _ in range(M):
  a1,a2=map(int, input().split())
  a1-=1
  a2-=1
  if (min(a1,a2),max(a1,a2)) not in checked:
    checked.append((min(a1,a2),max(a1,a2)))
    unite(a1,a2)
    nums[a1]-=1
    nums[a2]-=1

for _ in range(K):
  a1,a2=map(int, input().split())
  a1-=1
  a2-=1
  if same(a1,a2) and (min(a1,a2),max(a1,a2)) not in checked:
    nums[a1]-=1
    nums[a2]-=1
  if (min(a1,a2),max(a1,a2)) not in checked:
    checked.append((min(a1,a2),max(a1,a2)))
for i in range(N):
    par[i]=find(i)

for i in range(N):
    nums[i]=nums[i]+par.count(par[i])-1
print(" ".join(list(map(str,nums))))

### FIXED CODE ###

N,M,K=map(int, input().split())
par=[-1 for _ in range(N)]
nums=[-1 for _ in range(N)]
#実装
def find(x):
    if par[x]<0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def size(x):
    return -par[find(x)]

def unite(x,y):
    x,y=find(x),find(y)
    if x==y:
        return
    if x>y:
        x,y=y,x
    par[x]+=par[y]
    par[y]=x

def same(x,y):
    return find(x)==find(y)


for _ in range(M):
    a1,a2=map(int, input().split())
    a1-=1
    a2-=1
    unite(a1,a2)
    nums[a1]-=1
    nums[a2]-=1

for _ in range(K):
    a1,a2=map(int, input().split())
    a1-=1
    a2-=1
    if same(a1,a2):
        nums[a1]-=1
        nums[a2]-=1


for i in range(N):
    nums[i]+=size(i)

print(" ".join(list(map(str,nums))))
### BUGGY CODE ###

n = int(input())
s = [0]*n
num = [[0]*26 for i in range(n)]
count = 0
for i in range(n):
    s[i] = str(input())
    for j in range(10):
        mozi = ord(s[i][j])
        num[i][mozi-97] += 1

for i in range(n):
    for j in list(range(i+1,n)):
        if num[i] == num[j]:
            count += 1    
print(count)

### FIXED CODE ###

from collections import Counter
n = int(input())
S = [str(sorted(input())) for _ in range(n)]

print(sum(map(lambda x: x * (x - 1) // 2, Counter(S).values())))
### BUGGY CODE ###


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

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

dic = {}

for i in A:

    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

lis = []

for i in dic:

    lis.append(dic[i])

lis.sort()

ans = 0

while len(lis) > K:

    ans += lis[0]
    del lis[0]

print (ans)


### FIXED CODE ###


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

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

dic = {}

for i in A:

    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

lis = []

for i in dic:

    lis.append(dic[i])

lis.sort()

ans = 0

num = len(lis) - K
if num < 0:
    num = 0

for i in range(num):
    ans += lis[i]

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

from itertools import combinations

N = int(input())
A = list(map(int, input().split()))

comb = list(combinations(range(N), 2))
sum = 0
mod = 10**9 + 7
for i in range(len(comb)):
        sum += A[comb[i][0]] * A[comb[i][1]] % mod
print(sum % mod)
        

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

c_sum = sum(A)
mod = 10**9 + 7
ans = 0

for i in range(N-1):
    c_sum -= A[i]
    ans += A[i] * c_sum % mod
ans %= mod
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 6)


def dp(H, memo={}):
    if H <= 0:
        return 0
    elif H in memo:
        return memo[H]
    res = min(dp(H - a, memo) + b for a, b in zip(A, B))
    memo[H] = res
    return res

H, N = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

print(dp(H))

### FIXED CODE ###

H, N = map(int, input().split())
AB = [[int(x) for x in input().split()] for _ in range(N)]
dp = [float('inf')] * (H + 1)
dp[0] = 0
for h in range(H + 1):
    for a, b in AB:
        h_new = min(h + a, H)
        dp[h_new] = min(dp[h] + b, dp[h_new])
print(dp[-1])
### BUGGY CODE ###

def fanctionA(n):
    AList = []
    BList = []
    tmp = 2
    
    while n > 1:
        if n % tmp == 0:
            if AList.count(tmp) == 0:
                AList.append(tmp)
                BList.append(1)
            else:
                BList[AList.index(tmp)] += 1
            n /= tmp
            tmp = 2
        else:
            tmp += 1
 
    
    return BList
  
    
N = int(input())
 
arr = fanctionA(N)
 
tmp = 1
count = 0
for a in arr:
    while 'true':
        if a >= tmp:
            a -= tmp
            count += 1
            tmp += 1
        else:
            tmp = 1
            break
 
print(count)

### FIXED CODE ###

def fanction(n):
    listIn = []
    tmp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if tmp % i == 0:
            cnt_in = 0
            while tmp % i ==0:
                cnt_in += 1
                tmp //= i
            listIn.append([i, cnt_in])

    if tmp != 1:
        listIn.append([tmp, 1])

    if listIn == []:
        listIn.append([n, 1])

    return listIn

N = int(input())

arr = fanction(N)

tmp = 1
count = 0
for a, b in arr:
    if a <= 1:
        continue
    while 'true':
        if b >= tmp:
            b -= tmp
            count += 1
            tmp += 1
        else:
            tmp = 1
            break

print(count)
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()

class UnionFind:
    def __init__(self, n):
        self.parents = [-1] * (n + 1)

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def size(self, x):
        return -self.parents[self.find(x)]

def main():
    N, K, L = map(int, input().split())
    road = UnionFind(N)
    train = UnionFind(N)

    for _ in range(K):
        p, q = map(int, input().split())
        road.union(p, q)
    
    for _ in range(L):
        r, s = map(int, input().split())
        train.union(r, s)
    
    ans = [1] * (N + 1)
    for i in range(1, N + 1):
        for j in range(i + 1, N + 1):
            if road.same(i, j) and train.same(i, j):
                ans[i] += 1
                ans[j] += 1
    for i in ans[1:]:
        print(i)    

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import defaultdict
def input(): return sys.stdin.readline().rstrip()

class UnionFind:
    def __init__(self, n):
        self.parents = [-1] * (n + 1)

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def size(self, x):
        return -self.parents[self.find(x)]

def main():
    N, K, L = map(int, input().split())
    road = UnionFind(N)
    train = UnionFind(N)

    for _ in range(K):
        p, q = map(int, input().split())
        road.union(p, q)
    
    for _ in range(L):
        r, s = map(int, input().split())
        train.union(r, s)
    
    ans = []
    counter = defaultdict(int)
    for i in range(1, N + 1):
        root = (road.find(i), train.find(i))
        ans.append(root)
        counter[root] += 1
    for i in range(1, N + 1):
        root = (road.find(i), train.find(i))
        print(counter[root])

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

n = int(input())
print(sum([i for i in range(1,n)]))

### FIXED CODE ###

n = int(input())-1
print(n*(n+1)//2)
### BUGGY CODE ###

#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------

N = int(input())						# 5

A=[]
for i in range(N):
	s = input()
	l = sorted(s)
	s = "".join(l)
	A.append(s)

A.sort()
S=set(A)

p("A ",A)
p("S ",S)


ans=0
for s in S:
	i = A.count(s)
	
	ans += i*(i-1)//2

print(ans)


### FIXED CODE ###

#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------

N = int(input())						# 5

from collections import defaultdict
D = defaultdict(int)

for i in range(N):
	s = input()
	l = sorted(s)
	s = "".join(l)
	D[s]+=1

p("D ",D)


ans=0
for k in D:
	i = D[k]
	ans += i*(i-1)//2

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

S = list(input())
Q = int(input())
L = []
count = 0
for i in range(Q):
    l = list(input().split())
    if len(l) == 1:
        count +=1
    else:
        l[1] = int(l[1])
        if count%2 == 1:
            if l[1] == 1:
                l[1] = 2
            else:
                l[1] = 1
        if l[1] == 1:
            S.insert(0,l[2])
        else:
            S.append(l[2])

if count%2 == 0:
    print(''.join(S))
else:
    S.reverse()
    print(''.join(S))



### FIXED CODE ###

from collections import deque
S = deque(input())
Q = int(input())
count = 0
for i in range(Q):
    l = list(input().split())
    if len(l) == 1:
        count +=1
    else:
        l[1] = int(l[1])
        if count%2 == 1:
            if l[1] == 1:
                l[1] = 2
            else:
                l[1] = 1
        if l[1] == 1:
            S.appendleft(l[2])
        else:
            S.append(l[2])

if count%2 == 0:
    print(''.join(list(S)))
else:
    S.reverse()
    print(''.join(list(S)))
### BUGGY CODE ###

import numpy as np

n=int(input())

a=[]

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

ans=0
anssub=0
tmpsum=0
a=np.sort(a)
for i in range(n-1):
    if a[i]!=a[i-1]:
        for k in range(i+1,n):
            tmp=a[i]^a[k]
            tmpsum=tmp+tmpsum
            #print(a[i])
            #print(a[k])
            #print('\0')
            ans=(ans+tmp)%1000000007

    else:
        ans=(ans+tmpsum)%1000000007
    if a[i]!=a[i+1]:
        tmpsum=0
print(ans)



### FIXED CODE ###

import numpy as np

n=int(input())



a= list(map(int,input().split()))
a=np.array(a,np.int64)


max=60
mod=10**9+7
ans=0
cnt1=0
cnt0=0


for i in range(max):
    new_a=(a>>i & 1)

    cnt1=np.count_nonzero(new_a)
    cnt0=n-cnt1
    ans=(ans+cnt1*cnt0*(2**i))%mod
    cnt1=0
    cnt0=0
print(ans)
### BUGGY CODE ###

h,w,d = map(int,input().split())
hw = ['' for _ in range(h*w)]

for i in range(h):
    row = list(map(int,input().split()))
    for j in range(w):
        hw[row[j]-1] = [i+1,j+1]

q = int(input())
for i in range(q):
    L,R = map(int,input().split())
    a = list(range(L,R+1,d))
    
    total = 0
    for j in range(len(a)-1):
        total += abs(hw[a[j+1]-1][0] - hw[a[j]-1][0]) + abs(hw[a[j+1]-1][1] - hw[a[j]-1][1])        
        
    print(total)

### FIXED CODE ###

h,w,d = map(int,input().split())
hw = [[] for _ in range(h*w+1)]
for i in range(h):
    row = list(map(int,input().split()))
    for j in range(w):
        hw[row[j]] = [i,j]
 
a = [0 for _ in range(h*w+1)]
for i in range(d+1,h*w+1):
    a[i] = a[i-d] + abs(hw[i][0] - hw[i-d][0]) + abs(hw[i][1] - hw[i-d][1])
 
q = int(input())
for i in range(q):
    L,R = map(int,input().split())
    print(a[R] - a[L])
### BUGGY CODE ###

s = input()
num_children = [0] * len(s)

for i in range(len(s)):
    rest = 10**100
    pos = i
    while rest > 0:
        if s[pos] == 'R' and s[pos + 1] == 'L':
            if rest % 2 == 0:
                rest = 0
                continue
            else:
                pos += 1
                rest = 0
                continue
        if s[pos] == 'R':
            pos += 1
            rest -= 1
            continue
        if s[pos] == 'L':
            pos -= 1
            rest -= 1
            continue
    num_children[pos] += 1
print(' '.join((str(v) for v in num_children)))


### FIXED CODE ###

s = input()
children_after_move = [0] * len(s)

children = 1
last_r_pos = 0
for i in range(1, len(s)):
    if s[i] == s[i - 1]:
        children += 1
    elif s[i] == 'L' and s[i - 1] == 'R':
        children_after_move[i] += children // 2
        children_after_move[i - 1] += children - children // 2
        children = 1
        last_r_pos = i - 1
    elif s[i] == 'R' and s[i - 1] == 'L':
        children_after_move[last_r_pos] += children // 2
        children_after_move[last_r_pos + 1] += children - children // 2
        children = 1
children_after_move[last_r_pos] += children // 2
children_after_move[last_r_pos + 1] += children - children // 2

print(' '.join((str(v) for v in children_after_move)))
### BUGGY CODE ###

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
    if i in a:dp[i]=0
print(dp[n])

### FIXED CODE ###

n,m=map(int,input().split())
A=set(int(input()) for i in range(m))
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
    if i in A:dp[i]=0
print(dp[n])