Zane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us.

 [Image] 

The girl lives in house m of a village. There are n houses in that village, lining in a straight line from left to right: house 1, house 2, ..., house n. The village is also well-structured: house i and house i + 1 (1 ≤ i < n) are exactly 10 meters away. In this village, some houses are occupied, and some are not. Indeed, unoccupied houses can be purchased.

You will be given n integers a_1, a_2, ..., a_{n} that denote the availability and the prices of the houses. If house i is occupied, and therefore cannot be bought, then a_{i} equals 0. Otherwise, house i can be bought, and a_{i} represents the money required to buy it, in dollars.

As Zane has only k dollars to spare, it becomes a challenge for him to choose the house to purchase, so that he could live as near as possible to his crush. Help Zane determine the minimum distance from his crush's house to some house he can afford, to help him succeed in his love.


-----Input-----

The first line contains three integers n, m, and k (2 ≤ n ≤ 100, 1 ≤ m ≤ n, 1 ≤ k ≤ 100) — the number of houses in the village, the house where the girl lives, and the amount of money Zane has (in dollars), respectively.

The second line contains n integers a_1, a_2, ..., a_{n} (0 ≤ a_{i} ≤ 100) — denoting the availability and the prices of the houses.

It is guaranteed that a_{m} = 0 and that it is possible to purchase some house with no more than k dollars.


-----Output-----

Print one integer — the minimum distance, in meters, from the house where the girl Zane likes lives to the house Zane can buy.


-----Examples-----
Input
5 1 20
0 27 32 21 19

Output
40
Input
7 3 50
62 0 0 0 99 33 22

Output
30
Input
10 5 100
1 0 1 0 0 0 0 0 1 1

Output
20


-----Note-----

In the first sample, with k = 20 dollars, Zane can buy only house 5. The distance from house m = 1 to house 5 is 10 + 10 + 10 + 10 = 40 meters.

In the second sample, Zane can buy houses 6 and 7. It is better to buy house 6 than house 7, since house m = 3 and house 6 are only 30 meters away, while house m = 3 and house 7 are 40 meters away.

Difficulty: EASY

Solutions:
(n, m, k) = map(int, input().split())
(*a,) = map(int, input().split())
print(min((abs(m - i) * 10 for (i, v) in enumerate(a, 1) if 0 < v <= k)))


(n, m, k) = [int(x) for x in input().strip().split(' ')]
pricies = [int(x) for x in input().strip().split(' ')]
m -= 1

def get_price(j):
	if j < 0 or j >= len(pricies) or pricies[j] == 0:
		return k + 1
	else:
		return pricies[j]
i = 1
while True:
	if k >= get_price(m + i) or k >= get_price(m - i):
		print(10 * i)
		break
	i += 1


(n, m, k) = [int(x) for x in input().split()]
houses = [int(x) for x in input().split()]
i = 1
m -= 1
status = 0
while status == 0:
	if m - i >= 0:
		if 0 < houses[m - i] <= k:
			status = 1
			break
	if m + i < len(houses):
		if 0 < houses[m + i] <= k:
			status = 2
			break
	i += 1
print(i * 10)


(n, m, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
p = m - 1
i = p - 1
j = p + 1
x = 0

def inrange(b):
	return 0 <= b < n
while True:
	if inrange(i) and inrange(j) and (a[i] > 0) and (a[j] > 0):
		if a[i] < a[j]:
			x = i
		else:
			x = j
		if a[x] <= k:
			break
	elif inrange(i) and a[i] > 0:
		x = i
		if a[x] <= k:
			break
	elif inrange(j) and a[j] > 0:
		x = j
		if a[x] <= k:
			break
	i -= 1
	j += 1
print(abs(x - p) * 10)


(n, m, k) = map(int, input().split())
houses = list(map(int, input().split()))
toright = houses[m:]
toleft = list(reversed(houses[:m - 1]))

def first_lower(lst, num):
	for i in range(len(lst)):
		if lst[i] <= num and lst[i] != 0:
			return i + 1
	return -1

def min(a, b):
	if a < 0 or b < 0:
		return a if b < 0 else b
	return a if a < b else b
print(min(first_lower(toright, k), first_lower(toleft, k)) * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
l = a[:m - 1]
l = l[::-1]
r = a[m:]
ind1 = 100000
ind2 = 100000
if m != 1:
	for i in range(0, len(l)):
		if l[i] <= k and l[i] != 0:
			ind1 = i
			ind1 = len(l) - i - 1
			break
if m != n:
	for i in range(len(r)):
		if r[i] != 0 and r[i] <= k:
			ind2 = i + m
			break
mini = min(abs(m - 1 - ind1), abs(m - 1 - ind2))
print(mini * 10)


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 99999999999999999
for i in range(n):
	if l[i] <= k and l[i] != 0 and (abs(i - m + 1) < ans):
		ans = abs(i - m + 1)
print(ans * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
m -= 1
ans = 1000
for i in range(m, -1, -1):
	if a[i] and a[i] <= k:
		ans = m - i
		break
for i in range(m, n):
	if a[i] and a[i] <= k:
		ans = min(ans, i - m)
		break
print(ans * 10)


(n, m, k) = map(int, input().split())
m -= 1
A = list(map(int, input().split()))
ans = 1000000000.0
for (i, a) in enumerate(A):
	if a == 0:
		continue
	if a <= k:
		ans = min(ans, abs(m - i))
print(ans * 10)


(n, m, k) = map(lambda x: int(x), input().split())
num = input()
list = [int(x) for x in num.split()]
a = n
for i in range(n):
	if list[i] != 0 and list[i] <= k and (abs(i - (m - 1)) < a):
		a = abs(i - (m - 1))
print(a * 10)


(n, m, k) = [int(i) for i in input().split()]
m -= 1
a = [int(i) for i in input().split()]
ans = 1000000
for i in range(n):
	if a[i] != 0 and a[i] <= k:
		ans = min(ans, abs(i - m))
print(ans * 10)


(n, m, k) = map(int, input().split())
house = list(map(int, input().split()))
ans = 1000
for i in range(len(house)):
	if house[i] != 0 and house[i] <= k:
		if abs(i + 1 - m) < ans:
			ans = abs(i + 1 - m)
print(10 * ans)


(n, m, k) = map(int, input().split())
m -= 1
d = 1000000000.0
a = list(map(int, input().split()))
for i in range(n):
	if a[i] <= k and a[i] > 0:
		d = min(d, 10 * abs(i - m))
print(d)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
min_dist = n + 1
m -= 1
for i in range(len(a)):
	if a[i] > 0 and a[i] <= k:
		min_dist = min(min_dist, abs(i - m))
print(min_dist * 10)


import sys

def solve():
	(n, m, k) = map(int, input().split())
	m = m - 1
	a = [int(i) for i in input().split()]
	min_d = 10 ** 9
	for i in range(n):
		if 0 < a[i] <= k:
			min_d = min(min_d, abs(m - i) * 10)
	ans = min_d
	print(ans)

def debug(x, table):
	for (name, val) in table.items():
		if x is val:
			print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
			return None
solve()


class house:
	n = 0
	m = 0
	k = 0
	price = []

	def __init__(self, val):
		(self.n, self.m, self.k) = val.split(' ')
		self.n = int(self.n)
		self.m = int(self.m)
		self.k = int(self.k)
		self.Input()

	def Input(self):
		pr = input('')
		for i in range(self.n):
			self.price.append(int(pr.split(' ')[i]))
		self.gfHouse()

	def gfHouse(self):
		gfPos = self.price[self.m - 1]
		ls = []
		for i in range(len(self.price)):
			if self.price[i] != 0:
				if self.price[i] <= self.k:
					ls.append(i)
		if ls.count != 0:
			for i in range(len(ls)):
				if i == 0:
					a = abs(ls[i] - (self.m - 1))
				else:
					s = abs(ls[i] - (self.m - 1))
					if s < a:
						a = s
			print(abs(a) * 10)
		else:
			print(0)

def Main():
	val = input('')
	crush = house(val)
Main()


(n, k, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
ans = []
k -= 1
for i in range(n):
	if k == i:
		continue
	if a[i] == 0:
		continue
	if a[i] <= m:
		ans.append(abs(k - i) * 10)
print(min(ans))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
res = 1
while True:
	if m - res - 1 >= 0:
		if 0 < a[m - res - 1] <= k:
			break
	if m + res - 1 < n:
		if 0 < a[m + res - 1] <= k:
			break
	res += 1
print(res * 10)


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
s = l[:m]
o = l[m:]
z = []
for i in range(len(s)):
	if s[i] != 0 and s[i] <= k:
		z.append((len(s) - 1 - i) * 10)
for j in range(len(o)):
	if o[j] != 0 and o[j] <= k:
		z.append((j + 1) * 10)
		break
print(min(z))


(n, m, k) = map(int, input().split())
m -= 1
l = [int(x) for x in input().split()]
q = []
for i in range(n):
	if l[i] != 0 and l[i] <= k:
		q.append(abs(i - m) * 10)
print(min(q))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
m -= 1
be = -1
af = n + 1
for i in range(n):
	if a[i] <= k and a[i] != 0 and (i < m) and (i > be):
		be = i
	elif a[i] <= k and a[i] != 0 and (i > m) and (i < af):
		af = i
if be == -1:
	print((af - m) * 10)
elif af == n + 1:
	print((m - be) * 10)
else:
	print(10 * min(m - be, af - m))


(n, m, k) = map(int, input().split())
a = [int(i) for i in input().split()]
i = m - 1
x = y = 1000
while i >= 0:
	if a[i] <= k and a[i] != 0:
		x = m - 1 - i
		break
	i -= 1
i = m - 1
while i < n:
	if a[i] <= k and a[i] != 0:
		y = i - m + 1
		break
	i += 1
if x < y:
	print(x * 10)
else:
	print(y * 10)


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
r = 10000
for i in range(n):
	if a[i] <= k and a[i] != 0:
		r = min(r, abs(m - i - 1))
print(r * 10)


(x, y, z) = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = []
for i in range(1, len(a)):
	if z >= a[i] and a[i] != 0:
		b.append(abs(y - i))
print(min(b) * 10)


(n, g, c) = map(int, input().split())
l = list(map(int, input().split()))
p = []
for i in range(n):
	if i != g - 1:
		if l[i] != 0:
			if l[i] <= c:
				p.append(i)
m = []
for i in range(len(p)):
	m.append(abs(g - p[i] - 1))
s = min(m)
print(s * 10)


(x, y, l) = map(int, input().split())
z = list(map(int, input().split()))
k = []
r = 10
for i in range(y - 2, -1, -1):
	if z[i] == 0:
		r = r + 10
		continue
	if z[i] <= l:
		k.append(r)
		break
	r = r + 10
r = 10
for i in range(y, x):
	if z[i] == 0:
		r = r + 10
		continue
	if z[i] <= l:
		k.append(r)
		break
	r = r + 10
print(min(k))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
i = m
l = []
u = 0
while i < n:
	if a[i] != 0 and a[i] <= k:
		r1 = i + 1
		u = 1
		break
	i = i + 1
i = m - 2
while i >= 0:
	if a[i] != 0 and a[i] <= k:
		l.append(i + 1)
		break
	i = i - 1
if len(l) == 0:
	print((r1 - m) * 10)
elif u == 0:
	x2 = (m - l[0]) * 10
	print(x2)
else:
	x1 = (r1 - m) * 10
	x2 = (m - l[0]) * 10
	print(min(x1, x2))


(n, m, k) = input().split()
n = int(n)
m = int(m)
k = int(k)
array = list(map(int, input().split()))
result = 101
i = 0
for i in range(n):
	if array[i] != 0 and array[i] <= k:
		if abs(i + 1 - m) < result:
			result = abs(i + 1 - m)
print(result * 10)


(n, m, k) = [int(x) for x in input().split()]
m = m - 1
a = [int(x) for x in input().split()]
mindist = float('inf')
for i in range(len(a)):
	if a[i] > 0 and a[i] <= k and (abs(i - m) * 10 < mindist):
		mindist = abs(i - m) * 10
print(mindist)


(n, m, k) = map(int, input().split())
listOfHouses = [int(x) for x in input().split()][:n]
listAvailableHouses = []
tempList = []
for x in listOfHouses:
	if x == 0:
		pass
	elif x <= k:
		listAvailableHouses.append(listOfHouses.index(x) + 1)
		listOfHouses[listOfHouses.index(x)] = 'A'
for x in listAvailableHouses:
	if x >= m:
		tempList.append((x - m) * 10)
	else:
		tempList.append((m - x) * 10)
print(min(tempList))


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
xi = 0
mx = 1000000008
m = m - 1
mxi = 0
for x in a:
	if x <= k and abs(xi - m) < mx and (x != 0):
		mx = abs(xi - m)
	xi = xi + 1
print(mx * 10)


(n_houses, girl_house, money) = map(int, input().split())
house_costs = list(map(int, input().split()))
girl_house -= 1
min_distance = 100000
for i in range(girl_house - 1, -1, -1):
	if house_costs[i] > 0 and house_costs[i] <= money:
		distance = (girl_house - i) * 10
		if distance < min_distance:
			min_distance = distance
for i in range(girl_house + 1, len(house_costs)):
	if house_costs[i] > 0 and house_costs[i] <= money:
		distance = (i - girl_house) * 10
		if distance < min_distance:
			min_distance = distance
print(min_distance)


(n, m, k) = map(int, input().split())
l_p = list(map(int, input().split()))
m -= 1
i = 1
while i < n:
	if m + i < n:
		if l_p[m + i] <= k and l_p[m + i] != 0:
			print(i * 10)
			quit()
	if m - i >= 0:
		if l_p[m - i] <= k and l_p[m - i] != 0:
			print(i * 10)
			quit()
	i += 1


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
distanceR = distanceL = 0
for i in range(m, n):
	distanceR += 10
	if a[i] <= k and a[i] != 0:
		break
else:
	distanceR = 0
for i in range(m - 2, -1, -1):
	distanceL += 10
	if a[i] <= k and a[i] != 0:
		break
else:
	distanceL = 0
if distanceL == 0:
	distanceL = distanceR
elif distanceR == 0:
	distanceR = distanceL
print(min(distanceR, distanceL))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
mymin = 200
for x in range(n):
	if a[x] > 0 and a[x] <= k:
		if mymin > abs(m - 1 - x):
			mymin = abs(m - 1 - x)
print(mymin * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
	if a[i] != 0:
		if a[i] <= k:
			b += [abs(i - (m - 1))]
m = min(b)
print(m * 10)


import sys
read = lambda : sys.stdin.readline().rstrip()
readi = lambda : int(sys.stdin.readline())
writeln = lambda x: sys.stdout.write(str(x) + '\n')
write = lambda x: sys.stdout.write(x)
(N, M, K) = map(int, read().split())
ns = list(map(int, read().split()))
chk = [0] * N
md = 101
midx = -1
for i in range(N):
	if ns[i] and ns[i] <= K:
		chk[i] = 1
for i in range(N):
	if chk[i]:
		d = abs(i - M + 1)
		if d <= md:
			md = d
writeln(md * 10)


def abs(n: int):
	if n < 0:
		n = -n
	return n
(n, m, k) = map(int, input().split())
house = list(map(int, input().split()))
ans = -1
for i in range(0, m - 1):
	if house[i] != 0 and house[i] <= k:
		ans = i
for i in range(m, n):
	if house[i] != 0 and house[i] <= k:
		if ans == -1 or abs(i - m + 1) < abs(ans - m + 1):
			print(abs(i - m + 1) * 10)
			exit(0)
		else:
			print(abs(ans + 1 - m) * 10)
			exit(0)
print(abs(ans - m + 1) * 10)


(n, m, k) = map(int, input().split())
m -= 1
n -= 1
prices = input().split()
for i in range(len(prices)):
	prices[i] = int(prices[i])

def go(houses, k, min_napr):
	check = 0
	for i in houses:
		if i == 0 or i > k:
			min_napr += 10
		else:
			check = 1
			break
	if check == 1:
		return min_napr
	else:
		return 1000000000000000000
min_l = 10
min_r = 10
min_total = 0
if m == 0:
	min_total = go(prices[1:], k, min_r)
elif m == n:
	min_total = go(prices[-2::-1], k, min_l)
elif m > 0 and m < n:
	min_r = go(prices[m + 1:], k, min_r)
	min_l = go(prices[m - 1::-1], k, min_l)
	min_total = min(min_r, min_l)
print(min_total)


(n, m, cash) = input().split()
houses = input().split()
buyable = []
for i in range(len(houses)):
	if int(houses[i]) <= int(cash) and int(houses[i]) != 0:
		buyable.append(i + 1)
for i in range(len(buyable)):
	buyable[i] = abs(buyable[i] - int(m))
print(min(buyable) * 10)


def read_array():
	x = []
	x1 = []
	x = input()
	x = x.split(' ')
	for r in range(len(x)):
		x1.append(int(x[r]))
	return x1

def find_distance(x, y):
	k = x[1] - 1
	d = x[2]
	mini = 10 ** 34
	for i in range(len(y)):
		if y[i] <= d and y[i] != 0 and (i != k):
			if abs(i - k) < mini:
				mini = abs(i - k)
	return mini
x = read_array()
y = read_array()
print(10 * find_distance(x, y))


(n, m, k) = list(map(int, input().split()))
m -= 1
print(10 * min((abs(i - m) for (i, c) in enumerate(map(int, input().split())) if 0 < c <= k)))


import math
(n, m, k) = map(int, input().split())
s = list(map(int, input().split()))
d = 10000
for i in range(n):
	z = math.fabs(i - m + 1)
	z = math.ceil(z)
	if s[i] <= k:
		if s[i] != 0:
			if z * 10 < d:
				d = z * 10
print(d)


import sys
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = n
for i in range(n):
	if a[i] != 0 and a[i] <= k and (ans > abs(m - i - 1)):
		ans = abs(m - i - 1)
print(ans * 10)


from sys import exit
n = 0
pos = 0
money = 0
for i in input().split():
	if n == 0:
		n = int(i)
	elif pos == 0:
		pos = int(i)
	else:
		money = int(i)
a = [0 for i in range(n + 2)]
cnt = 0
for i in input().split():
	cnt += 1
	a[cnt] = int(i)
res = 199999999
for i in range(pos + 1, n + 1):
	if a[i] > 0 and a[i] <= money:
		res = i - pos
		break
for i in range(pos, 0, -1):
	if a[i] > 0 and a[i] <= money:
		res = min(res, pos - i)
		break
print(int(10 * res))


import sys

def StrToInt(list_entry):
	map_object = map(int, list_entry)
	return list(map_object)

def calculeDistance(i, j):
	end = max(i, j)
	begin = min(i, j)
	return 10 * (end - begin)
(num_houses, girl_index, money) = StrToInt(input().split())
prices = StrToInt(input().split())
girl_index -= 1
min_value = sys.maxsize
for i in range(len(prices)):
	price = prices[i]
	if price != 0 and i != girl_index and (price <= money):
		distance = calculeDistance(i, girl_index)
		min_value = min(min_value, distance)
print(min_value)


(n, m, k) = list(map(int, input().split()))
A = list(map(int, input().split()))
m -= 1
min_dist = n + 1
min_index = -1
for i in range(len(A)):
	if A[i] != 0 and A[i] <= k and (abs(i - m) <= min_dist):
		min_index = i
		min_dist = abs(i - m)
print(min_dist * 10)


(u, mozao, k) = [int(x) for x in input().split()]
casas = [int(x) for x in input().split()]
l = 0
r = 0
a = 0
for i in range(u):
	l = -1
	r = -1
	if mozao - i - 1 >= 0:
		l = casas[mozao - i - 1]
	if mozao + i - 1 < u:
		r = casas[mozao + i - 1]
	if l > 0 and l <= k or (r > 0 and r <= k):
		a = i * 10
		break
print(a)


import sys
(n, m, k) = map(int, sys.stdin.readline().strip().split(' '))
houses = list(map(int, sys.stdin.readline().strip().split(' ')))
upper = float('Inf')
for i in range(m, n):
	if houses[i] != 0 and houses[i] <= k:
		upper = i - m + 1
		break
lower = float('Inf')
for i in range(m - 2, -1, -1):
	if houses[i] != 0 and houses[i] <= k:
		lower = m - i - 1
		break
if lower < upper:
	print(lower * 10)
else:
	print(upper * 10)


(n, m, k) = input().split(' ')
village = input().split(' ')
distance_house = float('inf')
for i in range(int(n)):
	house_price = int(village[i])
	if house_price > 0:
		if house_price <= int(k) and abs(int(m) - 1 - i) < abs(int(m) - 1 - distance_house):
			distance_house = i
print(abs(int(m) - 1 - distance_house) * 10) if distance_house != float('inf') else print(0)


(n, m, k) = map(int, input().split())
A = list(map(int, input().split()))
an = 0
(l, r) = (m - 1, m - 1)
while an == 0:
	if l >= 0 and A[l] > 0 and (A[l] <= k):
		an = abs(l - m + 1)
	if r < len(A) and A[r] > 0 and (A[r] <= k):
		an = abs(r - m + 1)
	l -= 1
	r += 1
print(10 * an)


(sayi, konum, budget) = map(int, input().split())
liste = list(map(int, input().split()))
dict1 = {}
list1 = []
list2 = []
for i in range(1, sayi + 1):
	if 0 != liste[i - 1] and liste[i - 1] <= budget:
		list1.append(i)
for k in list1:
	list2.append(abs(konum - k))
print(10 * min(list2))


(houses, girl, money) = map(int, input().split(' '))
costs = list(map(int, input().split(' ')))
can_afford = [(costs[i], i + 1) for i in range(houses) if money - costs[i] >= 0 and costs[i] != 0]
amt = [i[0] for i in can_afford]
house_no = [abs(i[1] - girl) for i in can_afford]
print(min(house_no) * 10)


(n, m, k) = map(int, input().split())
lst = list(map(int, input().split()))
m -= 1
d1 = m - 1
d2 = m + 1
conn1 = False
conn2 = False
for i in range(d1, -1, -1):
	if lst[i] <= k and lst[i] != 0:
		conn1 = True
		con1 = i
		break
for i in range(d2, n):
	if lst[i] <= k and lst[i] != 0:
		conn2 = True
		con2 = i
		break
if conn1:
	con1 = m - con1
if conn2:
	con2 -= m
if conn2 == False:
	print(10 * con1)
elif conn1 == False:
	print(10 * con2)
else:
	print(10 * (con1 if con1 < con2 else con2))


arr = input().split(' ')
n = int(arr[0])
m = int(arr[1])
k = int(arr[2])
arrn = input().split(' ')
a = [int(x) for x in arrn]
mid = m - 1
cost = 1
i = 1
while True:
	if mid - i >= 0 and a[mid - i] <= k and (a[mid - i] > 0) or (mid + i < n and a[mid + i] <= k and (a[mid + i] > 0)):
		print(str(cost * 10))
		break
	else:
		cost += 1
		i += 1


((houses, girl_house, dollars), houses) = (map(int, input().split()), input().split())
print(min([girl_house - i if girl_house > i else i - girl_house for i in range(1, len(houses) + 1) if 0 < int(houses[i - 1]) <= dollars]) * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
ans1 = 10000
ans2 = 10000
m -= 1
t1 = 0
t2 = 0
l = m
while l > 0:
	if a[l] == 0 or a[l] > k:
		l -= 1
		t1 += 10
	else:
		break
if l == 0 and a[l] <= k and (a[l] != 0) or l > 0:
	ans1 = t1
l = m
while l < len(a) - 1:
	if a[l] == 0 or a[l] > k:
		l += 1
		t2 += 10
	else:
		break
if l == len(a) - 1 and a[l] <= k and (a[l] != 0) or l < len(a) - 1:
	ans2 = t2
print(min(ans1, ans2))


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
v = -1
for i in range(n):
	if l[i] != 0 and l[i] <= k:
		if v == -1:
			v = abs(m - 1 - i)
		elif v > abs(m - 1 - i):
			v = abs(m - 1 - i)
print(v * 10)


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
mind = len(l) - 1
for i in range(len(l)):
	if i != m - 1 and 0 < l[i] <= k and (abs(i - m + 1) < mind):
		mind = abs(i - m + 1)
print(mind * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
	if a[i] == 0 or k - a[i] < 0:
		continue
	else:
		b.append(abs(m - i - 1))
print(min(b) * 10)


(n, m, k) = map(int, input().split())
a = [int(i) for i in input().split()]
l = []
for i in range(n):
	if a[i] > 0 and a[i] <= k:
		l.append(i)
l1 = [abs(i - (m - 1)) for i in l]
print(min(l1) * 10)


(n, m, k) = map(int, input().split())
ip = list(map(int, input().split()))
left = m - 1
right = m + 1
while left >= 1 or right <= n:
	if left >= 1 and ip[left - 1] != 0 and (ip[left - 1] <= k):
		print((m - left) * 10)
		break
	elif right <= n and ip[right - 1] != 0 and (ip[right - 1] <= k):
		print((right - m) * 10)
		break
	right += 1
	left -= 1


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
mi = int(1000000000.0)
for i in range(m, n):
	if a[i] <= k and a[i] != 0:
		mi = min(mi, i - m + 1)
for i in range(max(0, m - 2), -1, -1):
	if a[i] <= k and a[i] != 0:
		mi = min(mi, m - 1 - i)
print(mi * 10)


(n, m, k) = map(int, input().split())
c = list(map(int, input().split()))
l = 1000000000000000
for i in range(n):
	if c[i] != 0 and c[i] <= k:
		l = min(l, abs(m - i - 1) * 10)
print(l)


(n, m, k) = map(int, input().split(' '))
(n, m, k) = (int(n), int(m), int(k))
list1 = list(map(int, input().split(' ')))
dist = n + 1
for i in range(len(list1)):
	if list1[i] != 0 and list1[i] <= k:
		if abs(i + 1 - m) < dist:
			dist = abs(i + 1 - m)
print(dist * 10)


L = input()
D = input()
L = L.split()
n = L[0]
m = int(L[1])
k = int(L[2])
p = m - 1
D = D.split()
B = []
for i in range(len(D)):
	f = int(D[i])
	if f <= k and (i == p or f != 0):
		B.append(i)
V = len(B)
for j in range(V):
	if B[j] == p:
		pos = j
if B[0] == p:
	R = abs(p - B[pos + 1])
elif B[V - 1] == p:
	R = abs(p - B[V - 2])
else:
	R1 = abs(p - B[pos + 1])
	R2 = abs(p - B[pos - 1])
	if R1 <= R2:
		R = R1
	else:
		R = R2
R = R * 10
print(R)


(n, m, k) = map(int, input().split())
h = list(map(int, input().split()))
dist = 101
for i in range(len(h)):
	if h[i] > 0 and h[i] <= k:
		dist = min(dist, abs(m - 1 - i))
print(dist * 10)


(n, m, k) = map(int, input().split())
m -= 1
num = None
price = None
lst = [int(p) for p in input().split()]
for i in range(len(lst)):
	if lst[i] != 0 and lst[i] <= k:
		if price is None:
			num = i
			price = lst[i]
		elif abs(m - i) < abs(num - m) or (abs(m - i) == abs(num - m) and lst[i] < price):
			num = i
			price = lst[i]
print(int(abs(num - m) * 10))


def ri():
	return map(int, input().split())
(n, m, k) = ri()
m = m - 1
a = list(ri())
cand = 10 ** 99
for i in range(m, n):
	if a[i] == 0:
		continue
	if a[i] <= k:
		cand = i - m
		break
for i in range(0, m):
	if a[i] == 0:
		continue
	if a[i] <= k:
		cand = min(cand, m - i)
print(cand * 10)


A = list(map(int, input().split()))
Ai = list(map(int, input().split()))
n = A[0]
m = A[1]
k = A[2]
d = n
for i in range(1, n + 1):
	if 0 < Ai[i - 1] <= k and d > abs(m - i):
		d = abs(m - i)
print(d * 10)


a = list(map(int, input().split()))
(n, g, k) = (a[0], a[1], a[2])
prices = list(map(int, input().split()))
minn = n * 10
for i in range(len(prices)):
	if i >= g:
		v = (i - g + 1) * 10
	else:
		v = (g - i - 1) * 10
	if prices[i] != 0 and prices[i] <= k and (v < minn):
		minn = v
print(minn)


(n, love, money) = map(int, input().split(' '))
prices = [int(x) for x in input().split(' ')]
loveIndex = love - 1
l = 1
for i in range(len(prices)):
	try:
		leftPossible = prices[loveIndex - l] if loveIndex - l >= 0 else 0
	except IndexError:
		leftPossible = float('inf')
	try:
		rightPossible = prices[loveIndex + l]
	except IndexError:
		rightPossible = float('inf')
	if leftPossible <= money and leftPossible != 0:
		break
	elif rightPossible <= money and rightPossible != 0:
		break
	else:
		l += 1
print(l * 10)


(n, m, k) = [int(x) for x in input().split(' ')]
houses = [int(house) for house in input().split(' ')]
buyL = False
buyR = False
buyLpos = 9999999
buyRpos = 9999999
for i in range(m - 1, -1, -1):
	if houses[i] <= k and houses[i] != 0:
		buyL = houses[i]
		buyLpos = i
		break
for i in range(m, len(houses)):
	if houses[i] <= k and houses[i] != 0:
		buyR = houses[i]
		buyRpos = i
		break
disR = abs(buyRpos + 1 - m)
disL = abs(m - (buyLpos + 1))
ans = min(disL, disR)
ans *= 10
print(ans)


def main():
	[n, m, k] = [int(_) for _ in input().split()]
	prices = [0] + [int(_) for _ in input().split()]
	try:
		next_left = next((i for i in range(m - 1, 0, -1) if 0 < prices[i] <= k))
	except StopIteration:
		next_left = -1
	try:
		next_right = next((i for i in range(m + 1, n + 1) if 0 < prices[i] <= k))
	except StopIteration:
		next_right = -1
	if next_left == -1:
		print(10 * (next_right - m))
	elif next_right == -1:
		print(10 * (m - next_left))
	else:
		print(10 * min(m - next_left, next_right - m))
main()


(n, m, k) = [int(x) for x in input().split()]
houses = [int(x) for x in input().split()]
m -= 1
l = m - 1
r = m + 1
minDis = 10001
while l >= 0 or r < n:
	if l >= 0 and houses[l] != 0 and (houses[l] <= k):
		if abs(l - m) * 10 < minDis:
			minDis = abs(l - m) * 10
	if r < n and houses[r] != 0 and (houses[r] <= k):
		if abs(r - m) * 10 < minDis:
			minDis = abs(r - m) * 10
	l -= 1
	r += 1
print(minDis)


(n, m, k) = map(int, input().split())
(A, m) = (list(map(int, input().split())), m - 1)
for d in range(1, n):
	if m - d >= 0 and 0 < A[m - d] <= k or (m + d < n and 0 < A[m + d] <= k):
		print(10 * d)
		break


(len, stay, money) = list(map(int, input().split()))
import sys
listi = list(map(int, input().split()))
stay = stay - 1
flag1 = 0
(indexl, indexr) = (float('inf'), float('inf'))
flag2 = 0
for i in range(stay, -1, -1):
	if listi[i] <= money and listi[i] > 0:
		indexl = stay - i
		flag1 = 1
		break
for i in range(stay, len, 1):
	if listi[i] <= money and listi[i] > 0:
		indexr = i - stay
		flag2 = 1
		break
if flag1 == 1 or flag2 == 1:
	mini = min(indexl, indexr)
	result = int(mini * 10)
	print(result)
else:
	print(0)


import math
z = [int(x) for x in input().split()]
n = z[0]
m = z[1]
k = z[2]
nm = []
nm = [int(x) for x in input().split()]
c = []
for i in range(int(len(nm))):
	if int(nm[i]) > int(k) or int(nm[i]) == 0:
		c.append(0)
	else:
		c.append(1)
d = []
for i in range(int(len(c))):
	if int(c[i]) == 1:
		d.append(abs(i + 1 - int(m)))
	else:
		d.append(1000000000000)
print(min(d) * 10)


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
for i in range(n):
	if l[i] <= k and l[i] != 0:
		l[i] = 1
lp = []
for i in range(n):
	if l[i] == 1:
		d = abs(m - 1 - i)
		lp.append(d)
print(min(lp) * 10)


args = list(map(int, input().split(' ')))
numHouses = args[0]
girlHouse = args[1] - 1
moneyAmount = args[2]
village = list(map(int, input().split(' ')))
left = girlHouse - 1
right = girlHouse + 1
distance = 0
while True:
	distance += 10
	if left >= 0 and village[left] > 0 and (moneyAmount >= village[left]):
		print(distance)
		exit()
	if right < numHouses and village[right] > 0 and (moneyAmount >= village[right]):
		print(distance)
		exit()
	left -= 1
	right += 1


(n, girl, money) = map(int, input().split())
arr = list(map(int, input().split()))
girl -= 1
ans = 100000000
for (i, x) in enumerate(arr):
	if x != 0:
		if x <= money:
			if abs(i - girl) < ans:
				ans = abs(i - girl)
print(ans * 10)


(a, b, c) = map(int, input().split())
l = list(map(int, input().split()))
i = b
j = b - 1
yu = []
for i in range(len(l)):
	if l[i] != 0 and l[i] <= c:
		yu.append(i)
m = []
for i in range(len(yu)):
	r = abs(b - yu[i] - 1)
	m.append(r)
print(min(m) * 10)


INF = 200000.0
(n, m, k) = map(int, input().split())
m -= 1
aa = list(map(int, input().split()))
print(10 * min(map(lambda a: abs(a[0] - m) if a[1] and a[1] <= k else INF, enumerate(aa))))


(n, m, k) = map(int, input().split())
num = list(map(int, input().split()))
m -= 1
x = 101
y = 101
for i in range(m + 1, n):
	if num[i] <= k and num[i] != 0:
		x = i - m
		break
for j in range(0, m):
	if num[j] <= k and num[j] != 0:
		y = m - j
ans = [x, y]
print(min(ans) * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
menor = 101
for i in range(0, n):
	if a[i] <= k and a[i] != 0:
		if abs(i - (m - 1)) < menor:
			menor = abs(i - (m - 1))
print(menor * 10)


(n, m, k) = list(map(int, input().split()))
m -= 1
line = list(map(int, input().split()))
answer = n
for i in range(n):
	if line[i] == 0:
		continue
	if line[i] > k:
		continue
	answer = min(answer, abs(m - i))
print(answer * 10)


(n, m, k) = map(int, input().split())
a = input().split()
ans = 100009
i = 1
for j in a:
	if int(j) != 0 and int(j) <= k:
		ans = min(abs((i - m) * 10), ans)
	i += 1
print(ans)


(n, m, k) = map(int, input().split())
l = [int(i) for i in input().split()]
m -= 1
ans = []
for j in range(n):
	if l[j] != 0 and l[j] <= k:
		ans += [abs(j - m) * 10]
print(min(ans))


(n, m, k) = map(int, input().split())
(m, a) = (m - 1, list(map(int, input().split())))
for i in range(1, 100):
	if m - i >= 0 and a[m - i] in range(1, k + 1) or (m + i < n and a[m + i] in range(1, k + 1)):
		print(10 * i)
		break


from operator import itemgetter
(n, m, k) = map(int, input().split())
ai = list(map(int, input().split()))
m -= 1
ans = 100000
for i in range(n):
	if ai[i] != 0 and ai[i] <= k:
		ans = min(ans, 10 * abs(m - i))
print(ans)


(n, m, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
s = []
for i in range(n):
	if l[i] <= k and i != m - 1 and (l[i] != 0):
		s.append(i)
y = min([abs(m - i - 1) * 10 for i in s])
print(y)


string = input()
numbers = string.split(' ')
a = int(numbers[0])
b = int(numbers[1])
c = int(numbers[2])
string = input()
numbers = string.split(' ')
for x in range(a):
	numbers[x] = int(numbers[x])
houses = []
for x in range(a):
	y = numbers[x]
	if y != 0 and y <= c:
		houses.append(abs(x + 1 - b))
print(min(houses) * 10)


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
condition = 0
index = 0
j = m - 2
n = m
while condition != 1:
	if j >= 0 and l[j] != 0 and (k - l[j] >= 0):
		index = j
		condition = 1
		break
	elif n < len(l) and l[n] != 0 and (k - l[n] >= 0):
		index = n
		condition = 1
		break
	j = j - 1
	n = n + 1
if index > m:
	print(abs((index - m + 1) * 10))
else:
	print(abs((m - index - 1) * 10))


def distance(first_house_number, second_house_number):
	return abs(first_house_number - second_house_number + 1) * 10

def solver():
	(number_of_houses, girl_house_number, budget) = map(int, input().split())
	house_prices = [int(x) for x in input().split()]
	distances = [distance(i, girl_house_number) for i in range(number_of_houses) if 0 < house_prices[i] <= budget]
	print(min(distances))
solver()


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
x = []
y = []
for i in range(n):
	if l[i] == 0:
		continue
	elif l[i] <= k:
		x.append(i + 1)
for i in range(len(x)):
	if x[i] > m:
		y.append(x[i] - m)
	elif x[i] < m:
		y.append(m - x[i])
print(min(y) * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
counter = n + 1
for i in range(n):
	if a[i] <= k and abs(i - (m - 1)) <= counter and (a[i] is not 0):
		counter = abs(i - (m - 1))
print(counter * 10)


inputs = list(map(int, input().split()))
n = inputs[0]
m = inputs[1]
k = inputs[2]
houses = list(map(int, input().split()))
distance = (n - 1) * 10
for i in range(0, n):
	if i != m - 1 and houses[i] > 0 and (houses[i] <= k):
		part_dist = abs(m - 1 - i) * 10
		if part_dist < distance:
			distance = part_dist
print(distance)


(a, b, c) = input().split()
houses = int(a)
target = int(b) - 1
money = int(c)
costs = input().split()
closest = 100
for i in range(houses):
	if i > closest + target:
		break
	if int(costs[i]) <= money and abs(i - target) < closest and (int(costs[i]) > 0):
		closest = abs(i - target)
print(closest * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
mn = 100000
for i in range(m, n):
	if a[i] <= k and a[i] != 0:
		mn = (i - m + 1) * 10
		break
for i in range(m):
	if a[i] <= k and a[i] != 0:
		x = (m - 1 - i) * 10
		mn = min(mn, x)
print(mn)


(n, m, k) = map(int, input().split())
data = map(int, input().split())
temp = [abs(m - 1 - i) for (i, v) in enumerate(data) if v and v <= k]
res = min(temp)
print(res * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
d1 = 101
d2 = 101
for i in range(m - 1, n):
	if a[i] <= k and a[i] != 0:
		d1 = i - m + 1
		break
for i in range(m - 1, -1, -1):
	if a[i] <= k and a[i] != 0:
		d2 = m - i - 1
		break
print(10 * min(d1, d2))


q = list(map(int, input().split()))
h = list(map(int, input().split()))
a = q[0]
for i in range(q[0]):
	if h[i] != 0 and h[i] <= q[2] and (abs(i - q[1] + 1) <= a):
		a = abs(i - q[1] + 1)
print(10 * a)


a = input()
b = input()
n = int(a.split()[0])
m = int(a.split()[1]) - 1
k = int(a.split()[2])
c = b.split()
i = 1
r = 0
while m - i >= 0 and m + i < n:
	if int(c[m - i]) > 0 and int(c[m - i]) <= k or (int(c[m + i]) > 0 and int(c[m + i]) <= k):
		r = i * 10
		break
	i = i + 1
if r == 0:
	while m - i >= 0:
		if int(c[m - i]) > 0 and int(c[m - i]) <= k:
			r = i * 10
			break
		i = i + 1
if r == 0:
	while m + i < n:
		if int(c[m + i]) > 0 and int(c[m + i]) <= k:
			r = i * 10
			break
		i = i + 1
print(r)


import itertools
from collections import defaultdict

def main():
	(n, m, k) = [int(v) for v in input().split()]
	m = m - 1
	data = [int(v) for v in input().split()]
	r = 0
	mv = n + 1
	for i in range(n):
		if i != m:
			if 0 < data[i] <= k:
				if abs(i - m) < mv:
					r = i
					mv = abs(i - m)
	print(mv * 10)
main()


(n, m, k) = map(int, input().split(' '))
p = list(map(int, input().split(' ')))
m -= 1
d = 0
for i in range(m - 1, -1, -1):
	if p[i] != 0 and p[i] <= k:
		d = m - i
		break
for i in range(m + 1, n):
	if p[i] != 0 and p[i] <= k:
		if d == 0:
			d = i - m
			break
		d = min(d, i - m)
		break
print(10 * d)


x = input().split(' ')
y = input().split(' ')
x = list(map(int, x))
y = list(map(int, y))
n = x[0]
m = x[1]
k = x[2]
i = m
j = m - 1
left = 0
right = 0
check1 = False
check2 = False
while i + 1 <= n:
	right += 10
	if y[i] <= k and y[i] != 0:
		check1 = True
		break
	i += 1
while j > 0:
	left += 10
	if y[j - 1] <= k and y[j - 1] != 0:
		check2 = True
		break
	j -= 1
if check1 == True and check2 == True:
	if left <= right:
		print(left)
	else:
		print(right)
elif check1 == True:
	print(right)
else:
	print(left)


(n, k, m) = map(int, input().split())
l = [int(i) for i in input().split()]
mini = 100000
for i in range(0, n):
	if l[i] <= m and abs(i * 10 - (k - 1) * 10) < mini and l[i] and (mini >= 0):
		mini = abs(i * 10 - (k - 1) * 10)
print(mini)


(n, m, k) = map(int, input().split())
a = [int(i) for i in input().split()]
ans = 100
for (x, i) in enumerate(range(m, n, 1)):
	if a[i] > 0 and a[i] <= k:
		ans = x + 1
		break
for (y, j) in enumerate(range(m - 2, -1, -1)):
	if a[j] > 0 and a[j] <= k:
		ans = min(ans, y + 1)
		break
print(ans * 10)


n = [int(j) for j in input().split()]
house_price = [int(j) for j in input().split()]
w = []
for k in range(n[0]):
	if house_price[k] != 0 and house_price[k] <= n[2]:
		w.append(k)
distance = [abs(k - n[1] + 1) for k in w]
distance.sort()
print(distance[0] * 10)


(n, m, k) = (int(x) for x in input().split())
prices = [int(x) for x in input().split()]
ans = 1000000
for (i, price) in enumerate(prices):
	if price == 0:
		continue
	if price <= k:
		ans = min(ans, abs(m - 1 - i) * 10)
print(ans)


(n, m, k) = map(int, input().split())
n = n - 1
m = m - 1
a = list(map(int, input().split()))
l_d = 0
l_p = m + 1
if l_p > n:
	l_d = 999
else:
	found = False
	while l_p <= n:
		if a[l_p] > 0 and a[l_p] <= k:
			found = True
			break
		else:
			l_d += 1
			l_p += 1
	if found == False:
		l_d = 9999
r_d = 0
r_p = m - 1
if r_p < 0:
	r_d = 999
else:
	found = False
	while r_p >= 0:
		if a[r_p] > 0 and a[r_p] <= k:
			found = True
			break
		else:
			r_p -= 1
			r_d += 1
	if found == False:
		r_d = 999
print((min(r_d, l_d) + 1) * 10)


import heapq
from collections import deque
import sys
(n, m, k) = map(int, input().split())
m -= 1
s = list(map(int, input().split()))
d = n * 2
for i in range(n):
	if s[i] and s[i] <= k:
		tmp = abs(i - m)
		if tmp < d:
			d = tmp
print(d * 10)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
(n, m, k) = get_int_list()
lst = get_int_list()
ans = 10 ** 10
for i in range(n):
	if lst[i] <= k and lst[i] != 0 and (abs(m - 1 - i) < ans):
		ans = abs(m - 1 - i)
print(ans * 10)


inp = input().split()
n = int(inp[0])
m = int(inp[1])
k = int(inp[2])
houses = input().split()
distance = n
for i in range(n):
	house = int(houses[i])
	if house > 0 and house <= k:
		current = abs(m - 1 - i)
		if current < distance:
			distance = current
print(distance * 10)


import sys
import math
s = list(map(int, input().split()))
h = list(map(int, input().split()))
h = list(map(lambda x: s[2] - x, h))
mi = sys.maxsize
for (index, i) in enumerate(h):
	if i != s[2] and i >= 0 and (math.fabs(index + 1 - s[1]) < mi):
		mi = math.fabs(index + 1 - s[1])
print(int(mi * 10))


(n, m, k) = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
min_distance = n * 10
for (i, price) in enumerate(a):
	if price > 0 and k >= price:
		distance = abs(i * 10 - m * 10 + 10)
		if distance < min_distance:
			min_distance = distance
print(min_distance)


(n, m, k) = map(int, input().split())
m -= 1
lista = list(map(int, input().split()))
casa = n * 15
for i in range(n):
	if 0 < lista[i] <= k:
		casa = min(casa, abs(m - i) * 10)
print(casa)


first = input()
second = input()
first = first.split()
second = second.split()
nohouse = int(first[0])
girlhouseindex = int(first[1]) - 1
money = int(first[2])
plc = second[:]
del plc[girlhouseindex]
halfone = second[:girlhouseindex]
halfone.reverse()
halftwo = second[girlhouseindex + 1:]
indexone = 101
indextwo = 101
countone = 0
counttwo = 0
for i in halfone:
	countone += 1
	i = int(i)
	if i <= money and i != 0:
		indexone = countone
		break
for i in halftwo:
	counttwo += 1
	i = int(i)
	if i <= money and i != 0:
		indextwo = counttwo
		break
if indexone < indextwo:
	print(indexone * 10)
else:
	print(indextwo * 10)


n = input().split()
z = input().split()
house = int(n[0])
girl = int(n[1]) - 1
money = int(n[2])
a = list(map(lambda x: money >= int(x) and int(x) != 0, z))
b = set()
for i in range(len(a)):
	if a[i]:
		b.add(abs(i - girl) * 10)
if len(b) > 0:
	print(min(b))
else:
	print(float('inf'))


def get_int():
	from sys import stdin
	return int(stdin.readline().replace('\n', ''))

def get_int_list():
	from sys import stdin
	return [int(x) for x in stdin.readline().replace('\n', '').split(' ')]

def get_str():
	from sys import stdin
	return stdin.readline().replace('\n', '')

def buy_house(num_girl, dollars, village):
	dist = 10000000000.0
	for i in range(len(village)):
		checking_distance = num_girl - i
		if checking_distance != 0 and village[i] != 0 and (abs(checking_distance) < dist) and (village[i] <= dollars):
			dist = abs(checking_distance)
	return dist * 10
(n, m, k) = get_int_list()
village = get_int_list()
print(buy_house(m - 1, k, village))


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
l[m - 1] = 0
l1 = []
ans = 0
for i in range(0, len(l)):
	if l[i] <= k and l[i] != 0:
		d = abs(m - (i + 1))
		l1.append(d)
	l1.sort()
ans = 10 * l1[0]
print(ans)


import math

def main():
	(n, m, k) = map(int, input().split())
	a = list(map(int, input().split()))
	m -= 1
	i = j = m
	i -= 1
	j += 1
	t1 = t2 = 1000000000000000000000000000000
	while i >= 0:
		if a[i] <= k and a[i] != 0:
			t1 = 10 * (m - i)
			break
		i -= 1
	while j < len(a):
		if a[j] <= k and a[j] != 0:
			t2 = 10 * (j - m)
			break
		j += 1
	print(int(min(t1, t2)))
main()


(n, m, k) = map(int, input().split())
liste = [int(x) for x in input().split()]
liste2 = []
liste3 = []
for loop in range(len(liste)):
	if liste[loop] <= k and liste[loop] != 0:
		liste2.append(loop)
for loop in range(len(liste2)):
	liste3.append(abs(liste2[loop] + 1 - m))
print(min(liste3) * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for y in range(0, n):
	if k >= a[y] and a[y] != 0:
		b.append(abs(y - (m - 1)))
l = min(b)
print(l * 10)


(_, m, k) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
m -= 1

def solve(A, m, k):
	(i1, i2) = (m, m)
	while i1 >= 0 or i2 < len(A):
		if i1 >= 0 and A[i1] != 0 and (A[i1] <= k):
			return i1
		elif i2 < len(A) and A[i2] != 0 and (A[i2] <= k):
			return i2
		i2 += 1
		i1 -= 1
mh = solve(A, m, k)
print(10 * abs(mh - m))


R = lambda : map(int, input().split())
(n, m, k) = R()
a = list(R())
if m - 1 == 0:
	ans = 0
	for i in range(n):
		if a[i] != 0 and a[i] <= k:
			break
		ans += 10
	print(ans)
else:
	i_ans = -1
	for i in range(m - 1, -1, -1):
		if a[i] != 0 and a[i] <= k:
			i_ans = i
			break
	dis1 = (m - 1 - i_ans) * 10 if i_ans != -1 else 99999999999999
	i_ans = -1
	n = len(a)
	for i in range(m - 1, n):
		if a[i] != 0 and a[i] <= k:
			i_ans = i
			break
	dis2 = (i_ans - m + 1) * 10 if i_ans != -1 else 99999999999999
	print(min(dis1, dis2))


(n, m, k) = [int(v) for v in input().split()]
m -= 1
prices = [int(p) for p in input().split()]
closest_left = 50000
for i in range(m - 1, -1, -1):
	if prices[i] != 0 and prices[i] <= k:
		closest_left = abs(m - i) * 10
		break
closest_right = 50000
for i in range(m + 1, len(prices)):
	if prices[i] != 0 and prices[i] <= k:
		closest_right = abs(i - m) * 10
		break
print(min(closest_left, closest_right))


def count_meters(limit, balance):
	meters = 0
	last = int(limit[-1]) if len(limit) > 0 else None
	for i in range(len(limit)):
		house = int(limit[i])
		meters += 10
		if house != 0 and house <= balance:
			break
		elif i == len(limit) - 1:
			meters = 0
	return meters

def buy_house(line1, line2):
	n_houses = int(line1.split(' ')[0])
	girl = int(line1.split(' ')[1])
	balance = int(line1.split(' ')[2])
	prices = line2.split(' ')
	reversed_ = prices[:girl - 1][::-1]
	meters_l = count_meters(reversed_, balance)
	meters_r = count_meters(prices[girl:], balance)
	result = 0
	if meters_r != 0 and meters_l != 0:
		result = min(meters_r, meters_l)
	else:
		result = max(meters_r, meters_l)
	return result
line1 = input()
line2 = input()
print(buy_house(line1, line2))


l = [int(e) for e in input().split()]
le = [int(e) for e in input().split()]
min = 10000000000000000000000000000000
for i in range(l[0]):
	if le[i] != 0 and le[i] <= l[2]:
		if min > abs(l[1] - i - 1):
			min = abs(l[1] - i - 1)
print(min * 10)


a = input().split()
n = int(a[0])
m = int(a[1])
k = int(a[2])
ans = n - 1
A = input().split()
for i in range(n - m):
	x = int(A[i + m])
	if x != 0 and x <= k:
		ans = i + 1
		break
for i in range(m - 1):
	x = int(A[m - 2 - i])
	if x != 0 and x <= k:
		ans = min(ans, i + 1)
		break
print(ans * 10)


(n, m, sum) = map(int, input().split())
a = [int(i) for i in input().split()]
ans = n + 1
for i in range(n):
	if i == m - 1:
		continue
	elif a[i] == 0:
		continue
	elif a[i] <= sum:
		ans = min(ans, abs(m - i - 1))
print(ans * 10)


(n, m, k) = input().split()
(n, m, k) = (int(n), int(m), int(k))
M = list(map(int, input().split()))
M1 = []
M2 = []
if m == 1:
	for i in M:
		if i <= k and i != 0:
			x = M.index(i)
			m = x * 10
			break
elif m == n:
	M.reverse()
	for i in M:
		if i <= k and i != 0:
			x = M.index(i)
			m = x * 10
			break
else:
	for i in range(len(M)):
		if M[i] <= k and M[i] != 0:
			M1.append(i)
	for i in M1:
		y = abs(i - m + 1)
		M2.append(y)
	m = 10 * min(M2)
print(m)


(n, m, k) = map(int, input().split())
houses = list(map(int, input().split()))
m -= 1
best_house = -1
for (i, v) in enumerate(houses):
	if v != 0 and v <= k:
		if best_house == -1:
			best_house = i
		elif abs(best_house - m) > abs(i - m):
			best_house = i
print(abs(best_house - m) * 10)


nmk = list(map(int, input().split()))
a = list(map(int, input().split()))
distance = 10 * nmk[0]
for i in range(nmk[1] - 1, -1, -1):
	if a[i] != 0 and a[i] <= nmk[2]:
		distance = min(distance, abs(nmk[1] - 1 - i) * 10)
		break
for i in range(nmk[1], nmk[0]):
	if a[i] != 0 and a[i] <= nmk[2]:
		distance = min(distance, abs(nmk[1] - 1 - i) * 10)
		break
print(distance)


import sys

def main():
	(n, m, k) = map(int, input().split())
	m -= 1
	house = list(map(int, input().split()))
	right = left = 100000000
	for i in range(m + 1, n):
		if house[i] <= k and house[i] != 0:
			right = (i - m) * 10
			break
	for i in range(m - 1, -1, -1):
		if house[i] <= k and house[i] != 0:
			left = (m - i) * 10
			break
	print(str(min(left, right)))
main()


(n, m, k) = [int(x) for x in input().split(' ')]
alist = [int(x) for x in input().split(' ')]
ans1 = 100000
ans2 = 100000
for i in range(m, n):
	if alist[i] != 0 and alist[i] <= k:
		ans1 = (i - (m - 1)) * 10
		break
for i in range(m - 1):
	if alist[m - 2 - i] != 0 and alist[m - 2 - i] <= k:
		ans2 = 10 * (i + 1)
		break
print(min(ans1, ans2))


const = input().split(' ')
house = input().split(' ')
n = int(const[0])
m = int(const[1]) - 1
k = int(const[2])

def result():
	for i in range(0, n):
		if i <= m:
			if int(house[m - i]) > 0 and int(house[m - i]) <= k:
				return 10 * i
		if i + m < n:
			if int(house[m + i]) > 0 and int(house[m + i]) <= k:
				return 10 * i
	return -1
print(result())


n = list(map(int, input().split()))
x = n[0]
y = n[0]
p = list(map(int, input().split()))
for i in range(n[1] - 1, n[0]):
	if p[i] != 0 and p[i] <= n[2]:
		x = i - n[1] + 1
		break
for i in range(n[1] - 1, -1, -1):
	if p[i] != 0 and p[i] <= n[2]:
		y = n[1] - i - 1
		break
print(min(x, y) * 10)


a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
if a[1] == a[0]:
	m = 99999999999999
for i in range(a[1], a[0]):
	if b[i] <= a[2] and b[i] != 0:
		m = i - a[1] + 1
		break
	if i == a[0] - 1:
		m = 99999999999999
for i in range(a[1] - 1, -1, -1):
	if b[i] <= a[2] and b[i] != 0:
		n = a[1] - i - 1
		break
	if i == 0:
		n = 99999999999999
if n < m:
	print(n * 10)
else:
	print(m * 10)


import math
(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 1000000000.0
for i in range(0, n):
	if a[i] == 0:
		continue
	if a[i] <= k:
		ans = min(ans, abs(m - (i + 1)) * 10)
print(ans)


info = input().split()
geo = input().split()
num_casas = int(info[0])
pos_menina = int(info[1])
dinheiro = int(info[2])
distancia = 0
index_count = 0
for elemento in geo:
	elemento = int(elemento)
	if elemento != 0 and elemento <= dinheiro:
		medicao = index_count - (pos_menina - 1)
		if medicao < 0:
			medicao = medicao * -1
		if distancia == 0 or medicao < distancia:
			distancia = medicao
	index_count += 1
print(distancia * 10)


(n, m, k) = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
q = 1000000000000
for i in range(1, n + 1):
	if a[i - 1] <= k and a[i - 1] != 0:
		distance = abs(m - i)
		q = min(distance, q)
print(q * 10)


(n, m, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
p = []
for i in range(n):
	if a[i] != 0:
		if a[i] <= k:
			p.append(abs(i + 1 - m - 1 + 1) * 10)
print(min(p))


from math import fabs
inp = lambda : map(int, input().split())
(n, m, k) = inp()
arr = list(inp())
ans = float('inf')
for i in range(n):
	if arr[i] != 0 and arr[i] <= k:
		ans = min(ans, fabs(i - m + 1))
print(int(ans * 10))


(n, m, k) = map(int, input().split())
s = list(map(int, input().split()))
c = []
for i in range(n):
	if s[i] <= k and s[i] != 0:
		c.append(i + 1)
ans = 99999999999
for i in range(len(c)):
	if abs(m - c[i]) < ans:
		ans = abs(m - c[i])
print(ans * 10)


from sys import stdin, stdout
(n, m, k) = map(int, stdin.readline().split())
challengers = list(map(int, stdin.readline().split()))
m -= 1
i = 1
ans = 10
while True:
	if m + i < n and challengers[m + i] and (challengers[m + i] <= k):
		break
	if m - i >= 0 and challengers[m - i] and (challengers[m - i] <= k):
		break
	ans += 10
	i += 1
stdout.write(str(ans))


(n, m, k) = list(map(int, input().split()))
street = [int(i) for i in input().split()]
keys = []
for i in range(n):
	if 0 < street[i] <= k:
		keys.append(i)
min = abs(m - 1 - keys[0])
for index in keys:
	if abs(m - 1 - index) < min:
		min = abs(m - 1 - index)
print(min * 10)


(n, m, k) = (int(v) for v in input().split())
a = list((int(v) for v in input().split()))
print(10 * min((abs(m - 1 - i) for i in range(n) if a[i] and a[i] <= k)))


n = list(map(int, input().split()))
n1 = list(map(int, input().split()[:n[0]]))
lst = []
lst1 = []
for i in range(n[0]):
	if n1[i] != 0:
		if n1[i] <= n[2]:
			lst.append(i + 1)
for i in lst:
	s = n[1] - i
	if s < 0:
		s = s * -1
	lst1.append(s)
print(min(lst1) * 10)


inputs = list(map(int, input().split()))
n = inputs[0]
m = inputs[1]
k = inputs[2]
houses = list(map(int, input().split()))
ans = n - 1
for i in range(0, n):
	if i != m - 1 and houses[i] != 0 and (houses[i] <= k):
		curr = abs(m - i - 1)
		ans = min(curr, ans)
ans *= 10
print(ans)


(n, m, k) = map(int, input().split())
houses = [k for k in map(int, input().split())]
distance = 10
result = 200 * distance
houses_left = houses[:m - 1]
houses_right = houses[m:]
houses_left = houses_left[::-1]
for h in [houses_left, houses_right]:
	for i in range(len(h)):
		if 0 < h[i] <= k:
			result = min(result, (i + 1) * distance)
print(result)


X = list(map(int, input().split()))
Houses = list(map(int, input().split()))
(FHouse, LHouse) = (Houses[:X[1] - 1], Houses[X[1]:])
(MINF, MINL) = (1000, 1000)
for i in range(FHouse.__len__() - 1, -1, -1):
	if FHouse[i] <= X[2] and FHouse[i] != 0:
		MINF = i
		break
for i in range(LHouse.__len__()):
	if LHouse[i] <= X[2] and LHouse[i] != 0:
		MINL = X[1] + i
		break
print(min(abs(MINL - X[1] + 1), abs(MINF - X[1] + 1)) * 10)


(n, m, k) = map(int, input().split())
m -= 1
a = [int(i) for i in input().split()]
b = []
for i in range(n):
	if 0 < a[i] <= k:
		b.append(10 * abs(i - m))
b.sort()
print(b[0])


(n, m, k) = input().split()
m = int(m)
k = int(k)
a = input()
v = []
order = []
order = a.split()
for j in range(len(order)):
	order[j] = int(order[j])
for j in range(len(order)):
	if order[j] > 0 and order[j] <= k:
		v.append(j)
min = 20000
for b in v:
	c = abs(b - m + 1)
	if c < min:
		min = c
print(10 * min)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
min1 = float('inf')
for i in range(n):
	if a[i] != 0 and min1 > abs(m - 1 - i) * 10 and (a[i] <= k):
		min1 = abs(m - 1 - i) * 10
print(min1)


inp = input()
inp = inp.split()
n = int(inp[0])
m = int(inp[1])
k = int(inp[2])
a = []
inp = input().split()
for i in inp:
	a.append(int(i))
mind = 1000000000000000
dist = 0
for i in range(m, n):
	dist += 10
	if a[i] <= k and a[i] != 0:
		mind = dist
		break
dist = 0
for i in range(m - 2, -1, -1):
	dist += 10
	if a[i] <= k and a[i] != 0:
		if dist < mind:
			mind = dist
print(mind)


(n, m, k) = str(input()).split()
(n, m, k) = (int(n), int(m) - 1, int(k))
line = str(input()).split()
line = [int(it) for it in line]
(l, r) = (n, n)
for i in range(m, n):
	if 0 < line[i] <= k:
		r = i - m
		break
for i in range(m - 1, -1, -1):
	if 0 < line[i] <= k:
		l = m - i
		break
print(10 * min(l, r))


(n, m, k) = map(int, input().split())
h = list(map(int, input().split()))
h1 = []
for i in range(n):
	if h[i] != 0 and h[i] <= k:
		h1.append(abs(i + 1 - m))
print(10 * min(h1))


(n, m, k) = map(int, input().split())
prices = list(map(int, input().split()))
left = prices[:m - 1][::-1]
right = prices[m:]
tail = [0] * max(m - 1, n - m)
left += tail
right += tail
for (i, (l, r)) in enumerate(zip(left, right)):
	if 0 < l <= k or 0 < r <= k:
		break
print(i * 10 + 10)


(n, m, d) = map(int, input().split())
l = list(map(int, input().split()))
m -= 1
l1 = l[:m + 1]
l1.reverse()
l2 = l[m:]
ll1 = len(l1)
ll2 = len(l2)
i = 1
while True:
	if i < ll1 and l1[i] != 0 and (l1[i] <= d):
		break
	elif i < ll2 and l2[i] != 0 and (l2[i] <= d):
		break
	i += 1
print(i * 10)


(n, m, k) = [int(i) for i in input().strip().split()]
prices = [int(i) for i in input().strip().split()]
nearest = 10 * n
for i in range(n):
	if prices[i] != 0 and prices[i] <= k:
		if nearest > abs(i + 1 - m) * 10:
			nearest = abs(i + 1 - m) * 10
print(nearest)


(n, m, k) = map(int, input().split())
a = [int(x) for x in input().split()]
m -= 1
for i in range(1, len(a)):
	x = m - i
	if 0 <= x < len(a) and 0 < a[x] <= k:
		print(10 * i)
		break
	x = m + i
	if 0 <= x < len(a) and 0 < a[x] <= k:
		print(10 * i)
		break


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
m = m - 1
lp = m - 1
rp = m + 1
found = False
ansr = 10000000
if rp < n:
	while not found and rp < n:
		if l[rp] != 0 and l[rp] <= k:
			ansr = rp - m
			found = True
		rp += 1
	found = False
else:
	ansr = 100000
ansl = 1000000
if lp >= 0:
	while not found and lp >= 0:
		if l[lp] != 0 and l[lp] <= k:
			ansl = m - lp
			found = True
		lp -= 1
else:
	ansl = 100000
print(min(ansr, ansl) * 10)


(n, m, k) = map(int, input().split())
t = [int(i) for i in input().split()]
t1 = [int(j) for j in t if int(j) != 0 and int(j) <= k]
tt = []
for d in t1:
	for i in range(len(t)):
		if t[i] == d:
			tt.append(i + 1)
ttt = list(set(tt))
tttt = []
for i in ttt:
	tttt.append(abs(int(i) - m) * 10)
print(min(tttt))


l = list(map(int, input().split()))
houses = list(map(int, input().split()))
rightDis = l[1] - 1
leftDis = l[1] - 1
while houses[rightDis] == 0 or houses[rightDis] > l[2]:
	if rightDis >= len(houses) - 1:
		if houses[rightDis] == 0 or houses[rightDis] > l[2]:
			rightDis = 999999999
		break
	rightDis += 1
while houses[leftDis] == 0 or houses[leftDis] > l[2]:
	if leftDis < 0:
		if houses[leftDis] == 0 or houses[leftDis] > l[2]:
			leftDis = 999999999
		break
	leftDis -= 1
if leftDis < 0 or l[1] - 1 == 0:
	print((rightDis - (l[1] - 1)) * 10)
elif rightDis > len(houses) - 1 or l[1] == len(houses):
	print((l[1] - 1 - leftDis) * 10)
else:
	print(min(abs(rightDis - (l[1] - 1)), abs(l[1] - 1 - leftDis)) * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
z = a[m - 1]
x = []
for i in range(len(a)):
	if a[i] != 0 and a[i] <= k and (a[i] != z):
		if i > m - 1:
			x.append(i - (m - 1))
		else:
			x.append(m - 1 - i)
print(10 * min(x))


(a, b, c) = map(int, input().split())
lis2 = []
lis3 = []
lis = list(map(int, input().split()))
for i in range(len(lis)):
	if lis[i] <= c and lis[i] != 0:
		lis2.append(i + 1)
for i in range(len(lis2)):
	lis3.append(abs(lis2[i] - b))
print(min(lis3) * 10)


i = lambda : map(int, input().split())
(_, m, k) = i()
print(10 * min((abs(m - x) for (x, y) in enumerate(i(), start=1) if 0 < y <= k)))


(n, m, k) = [int(x) for x in input().split()]
ls = [int(x) for x in input().split()]
dp = []

def dist(f, t):
	return abs((t - f) * 10)
for i in range(0, n):
	if ls[i] != 0 and ls[i] <= k:
		dp.append(dist(m - 1, i))
	else:
		dp.append(1000)
print(min(dp))


(n, m, k) = map(int, input().split())
costs = [int(x) for x in input().split()]
m -= 1
for i in range(1, n):
	if m + i < n and costs[m + i] <= k and (costs[m + i] > 0) or (m - i >= 0 and costs[m - i] <= k and (costs[m - i] > 0)):
		print(10 * i)
		exit(0)


(n, m, k) = map(int, input().split())
foo = list(map(int, input().split()))
kiko = []
for i in range(n):
	if k >= foo[i] and foo[i] != 0:
		kiko.append(abs(i + 1 - m) * 10)
print(min(kiko))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
i = 1
ans = 0
while i < n:
	if m - i - 1 >= 0 and a[m - i - 1] <= k and (a[m - i - 1] != 0):
		ans = i
		break
	if m - 1 + i < n and a[m - 1 + i] <= k and (a[m - 1 + i] != 0):
		ans = i
		break
	i += 1
print(ans * 10)


from math import inf
from collections import deque
(n, m, k) = map(int, input().split())
a = deque(map(int, input().split()))
a.appendleft(0)
ans = inf
for i in range(1, n + 1):
	if a[i] != 0 and a[i] <= k and (abs(i - m) < ans):
		ans = abs(i - m)
print(10 * ans)


a = list(map(int, input().split()))
d = 200
n = a[0]
m = a[1]
k = a[2]
h = list(map(int, input().split()))
for i in range(1, n + 1, 1):
	if h[i - 1] and h[i - 1] <= k and (d > abs(i - m)):
		d = abs(i - m)
print(d * 10)


(n, m, k) = map(int, input().split())
l = [*map(int, input().split())]
tmp = {'Left': float('inf'), 'Right': float('inf')}
Counter = 1
for i in range(m - 2, -1, -1):
	if l[i] != 0 and l[i] <= k:
		tmp['Left'] = Counter
		break
	Counter += 1
Counter = 1
for i in range(m, n):
	if l[i] != 0 and l[i] <= k:
		tmp['Right'] = Counter
		break
	Counter += 1
print(min(tmp['Left'], tmp['Right']) * 10)


(n, m, k) = map(int, input().split())
houses = list(map(int, input().split()))
can_buy = []
for (i, house) in enumerate(houses):
	if i + 1 != m and house != 0 and (k >= house):
		can_buy.append(i + 1)
ind = abs(m - can_buy[0])
for index in can_buy:
	if abs(m - index) < ind:
		ind = abs(m - index)
print(f'{ind * 10}')


(n, m, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
m -= 1
i = m - 1
if i == -1:
	i = 0
j = m + 1
if j == n:
	j = n - 1
ans = 1234
while True:
	if a[i] != 0 and a[i] <= k:
		ans = (m - i) * 10
		break
	else:
		i -= 1
		if i == -1:
			i = 0
	if a[j] != 0 and a[j] <= k:
		ans = (j - m) * 10
		break
	else:
		j += 1
		if j == n:
			j = n - 1
print(ans)


from sys import stdin, stdout
(n, m, k) = map(int, stdin.readline().rstrip().split())
a = stdin.readline().rstrip().split()
a = [int(b) for b in a]
availableHouse = [i for i in range(n) if a[i] > 0 and a[i] <= k]
minDistance = 9999999
for i in availableHouse:
	if i < m - 1:
		minDistance = min([minDistance, (m - 1 - i) * 10])
	elif i > m - 1:
		minDistance = min([minDistance, (i - (m - 1)) * 10])
print(minDistance)


import math
(n, m, k) = input().split()
casas = input().split()
dist = math.inf
for i in range(int(n)):
	a = int(casas[i])
	if a != 0 and a <= int(k):
		dist = min(dist, abs(i + 1 - int(m)))
print(dist * 10)


a = lambda : map(int, input().split())
(d, e, f) = a()
print(min((abs(i - e) for (i, z) in enumerate(a(), 1) if 0 < z <= f)) * 10)


(n, m, k) = map(int, input().split())
(l, r) = (1 << 31, 1 << 31)
A = [int(x) for x in input().split()]
for i in range(m, n):
	if A[i] != 0 and A[i] <= k:
		r = i - m + 1
		break
for i in range(m - 2, -1, -1):
	if A[i] != 0 and A[i] <= k:
		l = m - 1 - i
		break
print(min(l, r) * 10)


(n, m, k) = map(int, input().split())
m -= 1
A = list(map(int, input().split()))
mans = 1000000000000
for i in range(len(A)):
	if A[i] != 0:
		if abs(m - i) < mans and A[i] <= k:
			mans = abs(m - i)
print(mans * 10)


(x, y, z) = map(int, input().split())
a = list(map(int, input().split()))
n = [abs(y - (i + 1)) for i in range(x) if a[i] <= z and a[i] != 0]
print(min(n) * 10)


(n, m, d) = map(int, input().split())
l = map(int, input().split())
dist = n * 2
m -= 1
for (i, h) in enumerate(l):
	if h == 0:
		continue
	elif h > d:
		continue
	else:
		n_dist = abs(i - m)
		if n_dist < dist:
			dist = n_dist
		else:
			break
print(dist * 10)


(n, m, k) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
m = m - 1
best = None
for (i, p) in enumerate(a):
	if (best is None or abs(i - m) < best) and p > 0 and (p <= k):
		best = abs(i - m)
print(10 * best)


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
l = m - 2
r = m
running = True
while running:
	if l >= 0:
		if a[l] <= k and a[l] != 0:
			ans = l
			running = False
	if r < len(a):
		if a[r] <= k and a[r] != 0:
			ans = r
			running = False
	l -= 1
	r += 1
print(abs(ans - (m - 1)) * 10)


(n, m, k) = map(int, input().split())
m -= 1
l = list(map(int, input().split()))
dist = 9999999999
for i in range(n):
	if l[i] != 0 and l[i] <= k:
		dist = min(dist, abs(m - i) * 10)
print(dist)


(n, m, k) = map(int, input().split())
ls = list(map(int, input().split()))
arr = []
for i in range(n):
	if ls[i] != 0 and ls[i] <= k:
		arr.append(abs(i - m + 1) * 10)
print(min(arr))


string = input().split(' ')
n = int(string[0])
m = int(string[1])
k = int(string[2])
houses = input().split(' ')
minDistance = float('inf')
for i in range(m - 1, n):
	if int(houses[i]) <= k and int(houses[i]) != 0 and (i != m - 1):
		minDistance = (i + 1 - m) * 10
		break
for i in range(m - 1, -1, -1):
	if int(houses[i]) <= k and int(houses[i]) != 0 and (i != m - 1):
		distance = (m - (i + 1)) * 10
		if distance < minDistance:
			minDistance = distance
print(minDistance)


(n, m, k) = map(int, input().split())
s = [int(i) for i in input().split()]
(x, y) = (0, 0)
d = s[m - 1::-1]
c = s[m - 1:n]
for i in range(len(d) - 1):
	if d[i + 1] != 0 and d[i + 1] <= k:
		x = i + 1
		break
for i in range(len(c) - 1):
	if c[i + 1] != 0 and c[i + 1] <= k:
		y = i + 1
		break
if x == 0 or y == 0:
	print(max(x, y) * 10)
else:
	print(min(x, y) * 10)


def is_available(value, k):
	if int(value) == 0:
		return False
	return int(value) <= k

def min_distance_possible(prices, n, m, k):
	previous_i = m - 1
	next_i = m + 1
	while previous_i >= 0 and next_i < n:
		if is_available(prices[previous_i], k):
			min = (m - previous_i) * 10
			return min
		if is_available(prices[next_i], k):
			min = (next_i - m) * 10
			return min
		previous_i -= 1
		next_i += 1
	if previous_i >= 0:
		while previous_i >= 0:
			if is_available(prices[previous_i], k):
				min = (m - previous_i) * 10
				return min
			previous_i -= 1
	while next_i < n:
		if is_available(prices[next_i], k):
			min = (next_i - m) * 10
			return min
		next_i += 1
first_line = input().split(' ')
prices = input().split(' ')
n = int(first_line[0])
m = int(first_line[1]) - 1
k = int(first_line[2])
print(min_distance_possible(prices, n, m, k))


(n, m, rs) = input().split()
n = int(n)
m = int(m)
rs = int(rs)
ls = map(int, input().split())
ls = list(ls)
ind = []
for (ni, i) in enumerate(ls):
	if i == 0:
		continue
	if i <= rs:
		ind.append(ni + 1)
fs = []
for j in ind:
	am = abs(m - j)
	fs.append(am)
lem = min(fs)
print(lem * 10)


(N, M, K) = map(int, input().split())
lista = [int(i) for i in input().split()]
(k, ans) = (0, [])
for i in lista:
	k += 1
	if i != 0 and i <= K:
		ans.append(abs(k - M))
ans.sort()
print(ans[0] * 10)


(n, m, k) = list(map(int, input().split()))
x = list(map(int, input().split()))
a = []
maximum = n + 1
for i in range(n):
	if x[i] != 0 and x[i] <= k:
		abc = (x[i], i)
		a.append(abc)
for j in range(len(a)):
	if a[j][0] <= k and abs(m - a[j][1] - 1) < maximum:
		maximum = m - a[j][1]
print(abs((maximum - 1) * 10))


import sys
lineno = 0
for l in sys.stdin:
	if lineno == 0:
		[n, m, k] = [int(i) for i in str(l).strip().split()]
	if lineno == 1:
		p = [int(i) for i in l.strip().split()]
		p = [10 * abs(d - (m - 1)) for (i, d) in zip(p, range(len(p))) if i != 0 and i <= k]
		print(min(p))
	lineno += 1


initial = input()
pricing = input()
first_line = list(map(int, initial.split()))
second_line = list(map(int, pricing.split()))
available = first_line[0]
her_house = first_line[1] - 1
money = first_line[2]
current_best = 1000000000
current = 99999999
for (index, item) in enumerate(second_line):
	if item <= money and item != 0:
		current = abs(index - her_house) * 10
		if current < current_best:
			current_best = current
print(current_best)


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
l1 = []
z = m - 1
i = 0
b = 100
while i < n:
	a = i - z
	if a < 0:
		a = a * -1
	if l[i] <= k and l[i] != 0:
		l1.append(a)
	i = i + 1
l1.sort()
print(l1[0] * 10)


(n, m, k) = map(int, input().split())
houses = map(int, input().split())
ans = min([abs(m - i) for (i, h) in enumerate(houses, start=1) if h <= k and h > 0])
print(10 * ans)


(n, m, k) = map(int, input().split())
ls = list(map(int, input().split()))
ans = []
m = m - 1
for x in range(len(ls)):
	if ls[x] != 0 and ls[x] <= k:
		ans = ans + [abs(m - x)]
print(10 * min(ans))


(n, m, k) = map(int, input().split())
L = list(map(int, input().split()))
m = m - 1
ans = float('inf')
for i in range(n):
	if L[i] <= k and L[i] != 0:
		x = abs(m - i)
		if x < ans:
			ans = x
print(ans * 10)


(n, m, k) = input().strip().split()
(n, m, k) = [int(n), int(m), int(k)]
arr = list((int(a) for a in input().split()))
girlhome = int(m - 1)
val1 = int(1000)
val2 = int(1000)
val = int(0)
i = int(girlhome - 1)
j = int(girlhome + 1)
while i >= 0:
	if arr[i] != 0 and arr[i] <= k:
		val1 = (girlhome - i) * 10
		break
	i = i - 1
while j < len(arr):
	if arr[j] != 0 and arr[j] <= k:
		val2 = (j - girlhome) * 10
		break
	j = j + 1
val = min(val1, val2)
print(val)


line = input()
(n, m, j) = [int(i) for i in line.split()]
line = input()
a = [int(i) for i in line.split()]
distancia = n
for k in range(n):
	if a[k] != 0 and a[k] != a[m - 1] and (a[k] <= j):
		if abs(m - (k + 1)) <= distancia:
			distancia = abs(m - (k + 1))
print(distancia * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
dist = 10 ** 9
for i in range(n):
	if a[i] > 0 and a[i] < k + 1:
		dist = min(dist, abs(m - i - 1) * 10)
print(dist)


import sys
import math
import bisect
import itertools

def main():
	(n, m, k) = map(int, input().split())
	A = list(map(int, input().split()))
	min_val = 10 ** 18
	for i in range(n):
		if A[i] and A[i] <= k:
			val = abs(i - (m - 1)) * 10
			min_val = min(min_val, val)
	print(min_val)
main()


(n, gf, m) = map(int, input().strip().split()[:3])
b = list(map(int, input().strip().split()[:n]))
c = 10 ** 3
for x in range(len(b)):
	if b[x] != 0 and b[x] <= m:
		k = x + 1
		p = abs(gf - k)
		if p < c:
			c = p
print(c * 10)


(qhouses, girlhouse, dallaz) = map(int, input().split())
houses = list(map(int, input().split()))
min_dist = 9999999
for (i, house) in enumerate(houses, 1):
	if dallaz >= house and house > 0:
		newdist = abs(girlhouse - i)
		if newdist < min_dist:
			min_dist = newdist
print(min_dist * 10)


(n, m, k) = map(int, input().split())
p = list(map(int, input().split()))
ans = n
for i in range(n):
	if p[i] != 0 and p[i] <= k:
		ans = min(ans, abs(i + 1 - m))
print(ans * 10)


(n, m, k) = map(int, input().split())
al = list(map(int, input().split()))
bl = [a if a <= k else 0 for a in al]
ret = n * 10
for (i, b) in enumerate(bl):
	if b > 0:
		tmp = abs(i + 1 - m) * 10
		if tmp < ret:
			ret = tmp
print(ret)


(n, m, k) = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
m -= 1
ind1 = -1
for i in range(m - 1, -1, -1):
	if arr[i] != 0 and arr[i] <= k:
		ind1 = i
		break
ind2 = n
for i in range(m + 1, n):
	if arr[i] != 0 and arr[i] <= k:
		ind2 = i
		break
if m - ind1 < ind2 - m and ind1 != -1 or ind2 == n:
	print((m - ind1) * 10)
else:
	print((ind2 - m) * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
x = 0
y = 0
for i in range(0, m):
	j = m - i - 1
	if a[j] != 0 and a[j] <= k:
		x = abs(m - j - 1) * 10
		break
for l in range(m, n):
	if a[l] != 0 and a[l] <= k:
		y = abs(m - l - 1) * 10
		break
if x != 0 and y != 0:
	print(min(x, y))
else:
	print(max(x, y))


(n, m, k) = (int(i) for i in input().split())
dms = [int(i) for i in input().split()]
right = -1
rastr = -1
left = -1
rastl = -1
for i in range(m, n):
	if dms[i] != 0 and dms[i] <= k:
		right = i
		rastr = i + 1 - m
		break
if rastr == -1:
	rastr = n
for i in range(m - 1, max(m - rastr, 0) - 1, -1):
	if dms[i] != 0 and dms[i] <= k:
		rastl = m - 1 - i
		break
if rastr != -1 and (rastr < rastl or rastl == -1):
	print(rastr * 10)
elif rastl == -1:
	print('False')
else:
	print(rastl * 10)


import sys
input_string = input()
input_array = [int(x) for x in input_string.split()]
number_of_houses = input_array[0]
girl_house = input_array[1]
budget = input_array[2]
input_string = input()
prices = [int(x) for x in input_string.split()]
min_distance = number_of_houses + 1
for i in range(len(prices)):
	if prices[i] != 0 and prices[i] <= budget:
		if abs(girl_house - (i + 1)) < min_distance:
			min_distance = abs(girl_house - (i + 1))
print(min_distance * 10)


(a, b, c) = map(int, input().split())
l = list(map(int, input().split()))
(v, z) = ([], [])
for i in range(len(l)):
	if l[i] <= c and l[i] != 0:
		v.append(i + 1)
for j in v:
	a = abs(j - b)
	z.append(a)
print(min(z) * 10)


def closestHouse(c, m, arr):
	closest = None
	for (idx, val) in enumerate(arr):
		if val != 0 and m >= val and (not closest or abs(idx + 1 - c) < abs(c - closest)):
			closest = idx + 1
	return abs(closest - c) * 10
(n, c, m) = map(int, input().split())
arr = list(map(int, input().split()))
print(closestHouse(c, m, arr))


(n, m, k) = [int(f) for f in input().split()]
mx = n
i = 1
for x in [int(f) for f in input().split()]:
	if x <= k and x != 0:
		if abs(i - m) < mx:
			mx = abs(i - m)
	i += 1
print(mx * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = a[:m - 1][::-1]
a = a[m:]
(bn, an) = (10 ** 10, 10 ** 10)
for i in range(len(a)):
	if a[i] <= k:
		if a[i] != 0:
			an = i
			break
for i in range(len(b)):
	if b[i] <= k:
		if b[i] != 0:
			bn = i
			break
if an < bn:
	print(10 * (1 + an))
else:
	print(10 * (1 + bn))


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
s = 0
g = 0
for i in range(m - 2, -1, -1):
	if l[i] != 0 and l[i] <= k:
		s = m - 1 - i
		break
for i in range(m, n):
	if l[i] != 0 and l[i] <= k:
		g = i - (m - 1)
		break
if s == 0:
	print(g * 10)
elif g == 0:
	print(s * 10)
else:
	print(min(s, g) * 10)


(n, m, k) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
t = 10 ** n
for i in range(m, n):
	if l[i] != 0 and k >= l[i]:
		t = (i - m + 1) * 10
		break
for i in range(m - 2, -1, -1):
	if l[i] != 0 and k >= l[i]:
		t = min(t, (m - i - 1) * 10)
		break
print(t)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
m -= 1
INF = float('inf')
(R, L) = (INF, -INF)
for i in range(m + 1, n):
	if a[i] == 0:
		continue
	if a[i] <= k:
		R = i
		break
for i in range(m - 1, -1, -1):
	if a[i] == 0:
		continue
	if a[i] <= k:
		L = i
		break
print(min(R - m, m - L) * 10)


def main():
	(n, m, k) = map(int, input().split())
	A = list(map(int, input().split()))
	m -= 1
	ds = int(n)
	for i in range(len(A)):
		if A[i] > 0 and A[i] <= k and (abs(i - m) < ds):
			ds = abs(i - m)
	print(ds * 10)
	return 0
main()


import math
ans = []
s = []
(n, m, k) = map(int, input().split())
m -= 1
l = list(map(int, input().split()))
for i in l:
	if i > 0 and i <= k:
		s += [i]
for i in range(n):
	for x in s:
		if l[i] == x:
			ans += [math.fabs(i - m)]
print(int(min(ans) * 10))


R = lambda : [int(x) for x in input().split()]
(n, m, k) = R()
m -= 1
print(min((abs(i - m) for (i, p) in enumerate(R()) if 0 < p <= k)) * 10)


(n, m, k) = map(int, input().split())
a = [int(x) for x in input().split()]
dis = 0
minm = 100000000
for i in range(0, n):
	if a[i] <= k and i != n and (a[i] != 0):
		dis = abs(i - m + 1) * 10
		if dis < minm:
			minm = dis
print(minm)


firstLine = input().split()
n = int(firstLine[0])
m = int(firstLine[1]) - 1
k = int(firstLine[2])
secondLine = input().split()
for i in range(1, n):
	if i <= m:
		if int(secondLine[m - i]) <= k and int(secondLine[m - i]) != 0:
			print(10 * i)
			break
	if i + m < n:
		if int(secondLine[i + m]) <= k and int(secondLine[m + i]) != 0:
			print(10 * i)
			break


(n, m, k) = [int(x) for x in input().split()]
prices = [int(x) for x in input().split()]
right_side = 1000000
for i in range(m, n):
	if prices[i] != 0 and prices[i] <= k:
		right_side = i - m + 1
		break
left_side = 1000000
for i in range(m - 2, -1, -1):
	if prices[i] != 0 and prices[i] <= k:
		left_side = m - i - 1
		break
print(min(left_side, right_side) * 10)


(x, y, z) = map(int, input().split())
a = input().split()
b = []
i = 0
while i < x:
	if int(a[i]) != 0 and int(a[i]) <= z:
		b.append(i + 1)
	i += 1
c = [abs(y - k) for k in b]
print(10 * min(c))


def algo():
	(_, girl, dollars) = map(int, input().split())
	houses = list(map(int, input().split()))
	east = len(houses) - girl
	girl -= 1
	west = girl
	for i in range(max(west, east)):
		if 0 <= girl - 1 - i and 0 < houses[girl - 1 - i] <= dollars:
			print((i + 1) * 10)
			break
		elif girl + 1 + i < len(houses) and 0 < houses[girl + 1 + i] <= dollars:
			print((i + 1) * 10)
			break
algo()


(n, k, d) = map(int, input().split())
k -= 1
z = list(map(int, input().split()))
table = []
i = 0
while i < n:
	if z[i] != 0 and z[i] <= d:
		table.append(abs(k - i) * 10)
	i += 1
print(min(table))


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
i = m - 1
left = i - 1
right = i + 1
count = 0
while 1:
	if left >= 0 and a[left] != 0 and (a[left] <= k):
		count += 10
		break
	elif right < n and a[right] != 0 and (a[right] <= k):
		count += 10
		break
	else:
		count += 10
	left -= 1
	right += 1
print(count)


(n, m, k) = map(int, input().split())
c = list(map(int, input().split()))
d = 10 ** 19
m -= 1
for i in range(n):
	if abs(i - m) < d and 0 < c[i] <= k:
		d = abs(i - m)
print(d * 10)


def menorDistancia(lista1, lista2):
	i = int(lista1[0])
	j = int(lista1[1]) - 1
	k = int(lista1[2])
	distanciaEsquerda = 999999999
	distanciaDireita = 999999999
	for index in range(j - 1, -1, -1):
		if 0 < int(lista2[index]) <= k:
			distanciaEsquerda = abs(j - index) * 10
			break
	for index in range(j + 1, i):
		if 0 < int(lista2[index]) <= k:
			distanciaDireita = abs(j - index) * 10
			break
	return min(abs(distanciaEsquerda), abs(distanciaDireita))
lista1 = input().split(' ')
lista2 = input().split(' ')
print(menorDistancia(lista1, lista2))


(N, M, K) = map(int, input().split())
As = list(map(int, input().split()))
ans = 10 * N
for i in range(N):
	if 0 < As[i] <= K:
		ans = min(ans, 10 * abs(M - i - 1))
print(ans)


(n, m, k) = map(int, input().split())
ar = list(map(int, input().split()))
m -= 1
r1 = n
r2 = n
for i in range(m, n):
	if ar[i] and ar[i] <= k:
		r2 = i - m
		break
for i in range(m, -1, -1):
	if ar[i] and ar[i] <= k:
		r1 = m - i
		break
print(min(r1, r2) * 10)


(n, m, k) = map(int, input().split())
mat = list(map(int, input().split()))
m -= 1
for i in range(1, n):
	if 0 >= mat[min(n - 1, m + i)] - k > -k or 0 >= mat[max(0, m - i)] - k > -k:
		print(i * 10)
		break


(n, m, k) = [int(n) for n in input().split()]
listo = input().split()
res = n * 10
for i in range(n):
	if 0 < int(listo[i]) <= k and abs(i + 1 - m) * 10 < res:
		res = abs(i + 1 - m) * 10
print(res)


def main():
	(n, m, k) = map(int, input().split())
	aa = list(map(int, input().split()))
	res = []
	if m > 1:
		for (i, a) in enumerate(aa[m - 2::-1]):
			if 0 < a <= k:
				res.append(i)
				break
	if m < n:
		for (i, a) in enumerate(aa[m:]):
			if 0 < a <= k:
				res.append(i)
				break
	print(min(res) * 10 + 10)
main()


s = input().split()
(n, m, k) = (int(s[0]), int(s[1]), int(s[2]))
m -= 1
s = input().split()
d = n
for i in range(n):
	if i == m:
		continue
	if s[i] == '0':
		continue
	if int(s[i]) > k:
		continue
	if d > abs(m - i):
		d = abs(m - i)
print(10 * d)


(n, a, m) = map(int, input().split())
town = list(map(int, input().split()))
x1 = n
x2 = n
for i in range(1, n - a + 1):
	if town[a + i - 1] <= m and town[a + i - 1] != 0:
		x1 = i
		break
town.reverse()
for i in range(1, a):
	if town[n - a + i] <= m and town[n - a + i] != 0:
		x2 = i
		break
print(10 * min(x1, x2))


(len_houses, girl, cash) = map(int, input().split())
houses = list(map(int, input().split()))
girl -= 1
min_distance = len_houses

def calc_distance(distance):
	x = girl - distance
	return x if x > 0 else x * -1
for i in range(len_houses):
	distance = calc_distance(i)
	if 0 < houses[i] and houses[i] <= cash and (distance < min_distance):
		min_distance = distance
print(min_distance * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
mn = 1000000
for i in range(n):
	if a[i] != 0 and a[i] <= k:
		mn = min(mn, abs(m - i - 1) * 10)
print(mn)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
m -= 1
left = m - 1
right = m + 1
while True:
	if left >= 0:
		if a[left] <= k and a[left] > 0:
			x = left
			break
		else:
			left -= 1
	if right < n:
		if a[right] <= k and a[right] > 0:
			x = right
			break
		else:
			right += 1
print(abs(m - x) * 10)


import sys
a = list(map(int, input().split()))
(n, m, k) = (a[0], a[1], a[2])
a2 = list(map(int, input().split()))
d1 = d2 = f = f2 = 0
for i in range(m - 2, -1, -1):
	if a2[i] > k or a2[i] == 0:
		d1 += 10
	else:
		d1 += 10
		f = 1
		break
for i in range(m, n):
	if a2[i] > k or a2[i] == 0:
		d2 += 10
	else:
		d2 += 10
		f2 = 1
		break
if f == 0:
	print(d2)
elif f2 == 0:
	print(d1)
else:
	print(min(d1, d2))


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
c = 10 ** 10
m = m - 1
for i in range(n):
	if l[i] <= k and i != m and (l[i] != 0):
		x = abs(i - m)
		z = x * 10
		if z < c:
			c = z
print(c)


r = lambda : map(int, input().split())
(n, g, cash) = r()
l = min((abs(g - (i + 1)) for (i, x) in enumerate(list(r())) if x <= cash and x != 0)) * 10
print(l)


import sys
from collections import Counter
from math import factorial
input = sys.stdin
output = sys.stdout
combinations_dynamic = dict()

def combinations(n, k):
	if k > n - k:
		k = n - k
	if k < 0:
		return 0
	if n < 1:
		return 0
	if k == 0:
		return 1
	if k == 1:
		return n
	question = tuple((n, k))
	if question not in combinations_dynamic:
		combinations_dynamic[question] = combinations(n - 1, k - 1) + combinations(n - 1, k)
	return combinations_dynamic[question]

def read_int():
	return [int(x) for x in input.readline().rstrip().split()]
(n, m, k) = read_int()
mas = read_int()
m -= 1
answer = n * 10
for (i, price) in enumerate(mas):
	if 0 < price <= k:
		answer = min(answer, 10 * abs(m - i))
output.write('%d\n' % answer)


import sys
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	q = ain()
	n = q[0]
	m = q[1]
	k = q[2]
	a = ain()
	cnt1 = m - 1
	cnt2 = m - 1
	flag = 0
	temp1 = 0
	temp2 = 0
	nflag = 0
	for i in range(n):
		if cnt1 < n:
			if a[cnt1] <= k and a[cnt1] != 0:
				flag = flag + 1
				temp1 = cnt1
			if cnt1 == n - 1 and flag == 0:
				nflag = 1
			cnt1 += 1
		if cnt2 >= 0:
			if a[cnt2] <= k and a[cnt2] != 0:
				flag = flag + 1
				temp2 = cnt2
			if cnt2 == 0 and flag == 0:
				nflag = 0
			cnt2 -= 1
		if flag != 0:
			if nflag == 1:
				print(abs((temp2 - m + 1) * 10))
			else:
				print((cnt1 - m) * 10)
			break
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


class CodeforcesTask796ASolution:

	def __init__(self):
		self.result = ''
		self.n_m_k = []
		self.prices = []

	def read_input(self):
		self.n_m_k = [int(x) for x in input().split(' ')]
		self.prices = [int(x) for x in input().split(' ')]

	def process_task(self):
		left = self.prices[:self.n_m_k[1] - 1][::-1]
		right = self.prices[self.n_m_k[1]:]
		dl = 1000
		dr = 1000
		i = 1
		for l in left:
			if l:
				if l <= self.n_m_k[2]:
					dl = i
					break
			i += 1
		i = 1
		for l in right:
			if l:
				if l <= self.n_m_k[2]:
					dr = i
					break
			i += 1
		dist = 10 * min(dl, dr)
		self.result = str(dist)

	def get_result(self):
		return self.result
Solution = CodeforcesTask796ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


def main():
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	left_side_index = -1
	right_side_index = -1
	for i in range(m - 1, len(arr), 1):
		if arr[i] != 0 and arr[i] <= k:
			right_side_index = i
			break
	for i in range(m - 1, -1, -1):
		if arr[i] != 0 and arr[i] <= k:
			left_side_index = i
			break
	if left_side_index != -1 and right_side_index != -1:
		print(min(m - 1 - left_side_index, right_side_index - (m - 1)) * 10)
	elif left_side_index != -1 and right_side_index == -1:
		print((m - 1 - left_side_index) * 10)
	elif left_side_index == -1 and right_side_index != -1:
		print((right_side_index - (m - 1)) * 10)
main()


first_ = [int(x) for x in input().split()]
sec_ = [int(x) for x in input().split()]
dom_dev = first_[1]
dengi = first_[2]
full = 0
varianti = []
var2 = []
i = 1
for house in sec_:
	if dengi >= house and house is not full:
		varianti.append(i)
	i += 1
for var in varianti:
	var2.append(abs(int(var) - int(dom_dev)) * 10)
print(min(var2))


(n, zane, money) = map(int, input().split())
houses = [int(x) for x in input().split()]

def findHouseToBuy(n, zane, money):
	start = zane - 1
	end = zane - 1
	distance = 10
	while start > 0 and end < n - 1:
		start -= 1
		end += 1
		if houses[start] != 0 and houses[start] <= money or (houses[end] != 0 and houses[end] <= money):
			return distance
		distance += 10
	while start > 0:
		start -= 1
		if houses[start] != 0 and houses[start] <= money:
			return distance
		distance += 10
	while end < n - 1:
		end += 1
		if houses[end] != 0 and houses[end] <= money:
			return distance
		distance += 10
print(findHouseToBuy(n, zane, money))


(n, m, k) = map(int, input().split())
m -= 1
p = [int(x) for x in input().split()]
buyable = [i for (i, x) in enumerate(p) if x and x <= k]
dist = abs(m - min(buyable, key=lambda x: abs(m - x)))
print(dist * 10)


(n, m, k) = map(int, input().split())
m -= 1
a = list(map(int, input().split()))
r = []
for i in range(len(a)):
	if 0 < a[i] <= k:
		r.append(abs(m - i) * 10)
	else:
		r.append(10 ** 20)
print(min(r))


(n, m, k) = map(int, input().split())
prices = list(map(int, input().split()))
minDistance = 1000000
for i in range(0, n):
	if prices[i] != 0 and prices[i] <= k:
		minDistance = min(minDistance, abs(i - (m - 1)))
ans = 10 * minDistance
print(ans)


(n, m, k) = map(int, input().strip().split(' '))
houses = list(map(int, input().strip().split(' ')))
count = 0
for i in range(m, n):
	count += 10
	if houses[i] > 0 and houses[i] <= k:
		break
	if i == n - 1:
		count = 1000
right_min = count
houses.reverse()
count = 0
for i in range(n - m + 1, n):
	count += 10
	if houses[i] > 0 and houses[i] <= k:
		break
	if i == n - 1:
		count = 1000
left_min = count
if left_min == 0:
	print(right_min)
elif right_min == 0:
	print(left_min)
else:
	print(min(left_min, right_min))


(total, herpos, amount) = input().split()
total = int(total)
herpos = int(herpos)
amount = int(amount)
prizes = input().split()
prizes = list(map(int, prizes))
if herpos == 1:
	distance = 0
	i = 1
	while i < total:
		if prizes[i] > amount:
			distance = distance + 10
			i = i + 1
		elif prizes[i] == 0:
			distance = distance + 10
			i = i + 1
		else:
			distance = distance + 10
			break
	print(distance)
elif herpos == total:
	distance = 0
	i = 2
	while i <= total:
		if prizes[-i] > amount:
			distance = distance + 10
			i = i + 1
		elif prizes[-i] == 0:
			distance = distance + 10
			i = i + 1
		else:
			distance = distance + 10
			break
	print(distance)
else:
	distance1 = 0
	i = 0
	j = 0
	while i < herpos - 1:
		if prizes[i] <= amount and prizes[i] != 0:
			j = 1
			i = i + 1
		elif j >= 1:
			j = j + 1
			i = i + 1
		else:
			j = 0
			i = i + 1
	distance1 = j * 10
	distance2 = 0
	i = 1
	j = 0
	while i <= total - herpos:
		if prizes[-i] <= amount and prizes[-i] != 0:
			j = 1
			i = i + 1
		elif j >= 1:
			j = j + 1
			i = i + 1
		else:
			j = 0
			i = i + 1
	distance2 = j * 10
	if distance1 == 0:
		distance = distance2
	elif distance2 == 0:
		distance = distance1
	elif distance1 < distance2:
		distance = distance1
	else:
		distance = distance2
	print(distance)


(n, c, b) = map(int, input().split())
l = list(map(int, input().split()))
k = []
for i in range(len(l)):
	if i + 1 != c and l[i] != 0:
		if l[i] <= b:
			k = k + [i + 1]
k = list(map(lambda x: abs(x - c) * 10, k))
print(min(k))


def ok(arr1, t, p):
	cost = float('inf')
	n = len(arr1)
	for i in range(n):
		if arr1[i] <= p and arr1[i] != 0:
			cost = min(cost, abs(i - t + 1) * 10)
	return cost
(n, t, p) = map(int, input().split())
arr1 = list(map(int, input().split()))
print(ok(arr1, t, p))


(n, m, k) = map(int, input().split())
ns = tuple(map(int, input().split()))
m -= 1
d = n
for (i, x) in enumerate(ns):
	if abs(i - m) > d:
		break
	if x != 0 and x <= k:
		d = abs(i - m)
print(d * 10)


(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a = [p if p <= k else 0 for p in a]
m -= 1
i = m
j = m
while i < n and a[i] == 0:
	i += 1
while j >= 0 and a[j] == 0:
	j -= 1
if i < n and j >= 0:
	print(10 * min(i - m, m - j))
elif i < n:
	print(10 * (i - m))
else:
	print(10 * (m - j))


(n, m, k) = input().split()
n = int(n)
m = int(m)
k = int(k)
d = list(input().split())
for i in range(n):
	d[i] = int(d[i])
ans = 1061109567
l1 = list(range(m - 1))
l1 = l1[::-1]
for i in l1:
	if d[i] != 0 and k >= d[i]:
		ans = m - i - 1
		break
for i in range(m, n):
	if d[i] != 0 and k >= d[i]:
		ans = min(ans, i - m + 1)
		break
print(ans * 10)


from sys import stdin
(n, m, k) = (int(i) for i in stdin.readline().strip().split(' '))
a = [int(i) for i in stdin.readline().strip().split(' ')]
m = m - 1
min_d = float('inf')
for (i, price) in enumerate(a):
	if 0 < price <= k:
		if abs(i - m) < min_d:
			min_d = abs(i - m)
print(min_d * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
m = m - 1
j = m - 1
r1 = n
r2 = n
while j >= 0:
	if a[j] != 0 and a[j] <= k:
		r1 = m - j
		break
	j = j - 1
j = m + 1
while j < n:
	if a[j] != 0 and a[j] <= k:
		r2 = j - m
		break
	j = j + 1
print(10 * min(r1, r2))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
m -= 1
ml = mr = 10000000000
for i in range(m + 1, n):
	if a[i] != 0 and a[i] <= k:
		mr = i
		break
for i in range(m - 1, -1, -1):
	if a[i] != 0 and a[i] <= k:
		ml = i
		break
print(min(abs(m - ml), abs(m - mr)) * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
	if i == m - 1:
		s = i + 1
	elif a[i] <= k and a[i] != 0:
		b.append(i + 1)
k = []
for i in range(len(b)):
	l = abs(s - b[i])
	k.append(l)
print(min(k) * 10)


def main():
	(n, m, k) = map(int, input().split())
	a = [int(i) for i in input().split()]
	dist1 = n
	dist2 = n
	m = m - 1
	for i in range(m, n):
		if a[i] != 0 and a[i] <= k:
			dist1 = i - m
			break
	for i in range(m, -1, -1):
		if a[i] != 0 and a[i] <= k:
			dist2 = m - i
			break
	print(min(dist1, dist2) * 10)
main()


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
d = defaultdict(list)
(n, m, k) = M()
l = L()
i = m - 1
key = 0
f = 0
ans = 10 ** 9
while i >= 0:
	if l[i] > 0 and l[i] <= k and (i != m - 1):
		key = i
		f = 1
		break
	i -= 1
if f:
	ans = abs(m - 1 - key) * 10
f = 0
i = m - 1
key2 = n - 1
while i < n:
	if l[i] > 0 and l[i] <= k and (i != m - 1):
		key2 = i
		f = 1
		break
	i += 1
if f:
	ans = min(ans, abs(key2 - m + 1) * 10)
print(ans)


(n, m, k) = map(int, input().split())
(a, cnt) = (list(map(int, input().split())), float('inf'))
i = m - 1
while i < n:
	if a[i] <= k and a[i] != 0:
		cnt = (i - m + 1) * 10
		break
	i += 1
i = m - 1
while i >= 0:
	if a[i] <= k and a[i] != 0:
		cnt = min((m - i - 1) * 10, cnt)
		break
	i -= 1
print(cnt)


def Zein():
	L = list(map(int, input().split()))
	(n, m, k) = L
	a = list(map(int, input().split()))
	res = []
	for i in range(len(a)):
		if i != m - 1 and a[i] != 0 and (a[i] <= k):
			res.append(i)
	return min((abs(i - (m - 1)) for i in res)) * 10
print(Zein())


(n, m, k) = [int(x) for x in input().split()]
prices = [int(x) for x in input().split()]
i = m - 1 - 1
j = m
found = False
while i > -1 or j < n:
	if i > -1:
		if k >= prices[i] and prices[i] != 0:
			found = True
	if j < n:
		if k >= prices[j] and prices[j] != 0:
			if found and prices[i] != 0 and (prices[j] < prices[i]):
				print((m - i - 1) * 10)
				break
			print((j - m + 1) * 10)
			break
	if found:
		print((m - i - 1) * 10)
		break
	i -= 1
	j += 1


(n, m, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
x = n + m
m -= 1
for i in range(n):
	if a[i] != 0 and a[i] <= k and (abs(i - m) <= abs(x - m)):
		x = i
print(10 * abs(x - m))


(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))

def rec(pos, n, k, shift):
	if pos + shift < 0 or pos + shift >= n:
		return (n + 1) * 10
	if arr[pos + shift] <= k and arr[pos + shift] != 0:
		return abs(m - 1 - pos - shift) * 10
	else:
		return rec(pos + shift, n, k, shift)
print(min(rec(m - 1, n, k, -1), rec(m - 1, n, k, 1)))


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
a1 = 1000
for i in range(m - 1):
	if l[i] <= k and l[i] != 0:
		a1 = (m - 1 - i) * 10
a2 = 1000
for i in range(m, n):
	if l[i] <= k and l[i] != 0:
		a2 = (i - m + 1) * 10
		break
print(min(a1, a2))


(n, m, k) = input().split()
(n, m, k) = (int(n), int(m), int(k))
arr = list(map(int, input().split()))
count = 0
left = right = 0
i = m - 1
while i != 0:
	i -= 1
	left += 1
	if arr[i] != 0 and arr[i] <= k:
		break
else:
	left = 101
i = m - 1
while i != len(arr) - 1:
	i += 1
	right += 1
	if arr[i] != 0 and arr[i] <= k:
		break
	if left < right:
		break
else:
	right = 101
if left > right:
	print(right * 10)
else:
	print(left * 10)


(n, m, k) = map(int, input().split())
houses = list(map(int, input().split()))
m = m - 1
before = m - 1
after = m + 1
(z_h1, z_h2) = (-1, -1)
(dist1, dist2) = (0, 0)
while before >= 0:
	val = houses[before]
	if val != 0 and val <= k:
		z_h1 = before
		break
	before -= 1
while after < n:
	val = houses[after]
	if val != 0 and val <= k:
		z_h2 = after
		break
	after += 1
if z_h1 >= 0:
	dist1 = (m - z_h1) * 10
if z_h2 >= 0:
	dist2 = (z_h2 - m) * 10
dist = dist1 if dist1 < dist2 and dist1 or dist2 <= 0 else dist2
print(dist)
pass


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
q = 1000
for i in range(0, m, 1):
	if l[i] <= k and l[i] != 0:
		ans = m - i - 1
if ans != 0:
	q = ans
for i in range(m, n, 1):
	if l[i] <= k and l[i] != 0 and (i - (m - 1) < q):
		ans = i - (m - 1)
		break
print(10 * ans)


line = input()
(n, m, k) = [int(i) for i in line.split()]
line2 = input()
line2 = line2.split()
r = 100
for i in range(1, n + 1):
	if int(line2[i - 1]) != 0 and int(line2[i - 1]) <= k:
		r = min(r, abs(i - m))
print(r * 10)


t = 0
n = input()
n = n.split()
k = int(n[2])
m = int(n[1])
n = int(n[0])
d1 = 999 * 999
d2 = d1
price = input()
price = price.split()
a = [0]
for i in range(n):
	a.append(int(price[i]))
for i in range(m, n + 1):
	if a[i] != 0:
		if a[i] <= k:
			d1 = i - m
			break
for i in range(m, 0, -1):
	if a[i] != 0:
		if a[i] <= k:
			d2 = m - i
			break
print(min(d1, d2) * 10)


dados = input().split(' ')
n = int(dados[0])
m = int(dados[1])
k = int(dados[2])
casas = input().split(' ')
retorno = 100
for i in range(n):
	calc = 0
	if int(casas[i]) != 0 and int(casas[i]) <= k:
		if m == 1:
			calc = abs(i + 1 - m)
		else:
			calc = abs(i - (m - 1))
		if calc < retorno:
			retorno = calc
retorno *= 10
print(retorno)


import heapq
(n, m, k) = map(int, input().split())
A = [*map(int, input().split())]
q = []
for i in range(n):
	heapq.heappush(q, (abs(i - (m - 1)), A[i]))
ans = None
while q:
	p = heapq.heappop(q)
	if p[1] != 0 and p[1] <= k:
		ans = 10 * p[0]
		break
print(ans)


def find_first(array, k):
	i = 0
	while i < len(array) - 1 and (k < array[i] or array[i] == 0):
		i = i + 1
	if len(array) != 0 and array[i] != 0 and (array[i] <= k):
		return i + 1
	else:
		return 200
nmk = input()
integ = [int(x) for x in nmk.split()]
n = integ[0]
m = integ[1]
k = integ[2]
costs = input()
costs = [int(x) for x in costs.split()]
array_right = costs[m:]
array_left = list(reversed(costs[:m - 1]))
val = min(find_first(array_right, k), find_first(array_left, k))
print(val * 10)


import math
napis = input().split()
ileDomow = int(napis[0])
gdzieMieszka = int(napis[1])
ilePieniedzy = int(napis[2])
kolejnyNapis = input().split()
listaCen = []
ktoreDomyMoznaKupic = []
indeksyTychDomow = []
if len(kolejnyNapis) == ileDomow:
	for x in range(len(kolejnyNapis)):
		listaCen.append(int(kolejnyNapis[x]))
	for y in range(len(listaCen)):
		if ilePieniedzy >= int(listaCen[y]) and listaCen[y] > 0:
			indeksyTychDomow.append(y + 1)
	najmniejszyDystans = int(math.fabs(int(indeksyTychDomow[0]) - gdzieMieszka))
	for z in range(len(indeksyTychDomow)):
		if math.fabs(int(indeksyTychDomow[z]) - gdzieMieszka) < najmniejszyDystans:
			najmniejszyDystans = math.fabs(int(indeksyTychDomow[z]) - gdzieMieszka)
	print(int(najmniejszyDystans * 10))


(n, m, k) = map(int, input().split())
m = m - 1
mn = n
x = [int(x) for x in input().split()]
for i in range(len(x)):
	if i != m and x[i] != 0 and (k >= x[i]):
		mn = min(mn, abs(m - i))
print(mn * 10)


(N, M, K) = map(int, input().split())
M -= 1
A = list(map(int, input().split()))
ans = int(1000000000.0)
for i in range(N):
	if A[i] == 0:
		continue
	if A[i] > K:
		continue
	ans = min(ans, abs(i - M))
print(ans * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
c = []
for i in range(len(a)):
	if a[i] <= k and a[i] != 0:
		c.append(i)
p = []
for i in range(len(c)):
	p.append(abs(c[i] - m + 1) * 10)
print(min(p))


(n, house, money) = map(int, input().split())
prices = list(map(int, input().split()))
length = []
for num in range(len(prices)):
	if prices[num] != 0 and num != house - 1:
		if prices[num] <= money:
			length.append(abs(house - 1 - num) * 10)
print(min(length))


(n, m, k) = list(map(int, input().split()))
prices = list(map(int, input().split()))
girl_house = m - 1
left = girl_house - 1
right = girl_house + 1
distance = 0
while left > -1 or right < n:
	distance += 10
	if left >= 0 and 0 < prices[left] <= k or (right < n and 0 < prices[right] <= k):
		break
	left -= 1
	right += 1
print(distance)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
a1 = a[m:]
a2 = list(reversed(a[:m - 1]))
(res1, res2) = (10 ** 8, 10 ** 8)
for (i, h) in enumerate(a1):
	if 0 < h <= k:
		res1 = i + 1
		break
for (i, h) in enumerate(a2):
	if 0 < h <= k:
		res2 = i + 1
		break
print(min(res1, res2) * 10)


S1 = input()
(A, B, C) = S1.split(' ')
A = int(A)
B = int(B)
C = int(C)
S2 = input().split(' ')
aa = []
for i in range(A):
	if int(S2[i]) == 0 or int(S2[i]) > C:
		aa.append(A * 100)
	elif S2.index(S2[i]) + 1 > B:
		aa.append(10 * (S2.index(S2[i]) - B + 1))
	else:
		aa.append(10 * (B - S2.index(S2[i]) - 1))
	S2[i] = 0
print(min(aa))


def main():
	(n, m, k) = [int(x) for x in input().split()]
	casas = [int(x) for x in input().split()]
	casas_compraveis = [i + 1 for (i, casa) in enumerate(casas) if casa <= k and casa != 0]
	print(casa_perto(m, casas_compraveis) * 10)

def casa_perto(m, lista):
	Min = abs(m - lista[0])
	for i in lista:
		dist = abs(m - i)
		if dist < Min:
			Min = dist
	return Min
main()


from math import inf

def solve(n, m, k, a):
	m -= 1
	(x, y) = (inf, inf)
	for i in range(m - 1, -1, -1):
		if a[i] and a[i] <= k:
			x = m - i
			break
	for i in range(m + 1, n):
		if a[i] and a[i] <= k:
			y = i - m
			break
	return min(x, y) * 10

def main():
	(n, m, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	print(solve(n, m, k, a))
main()


(n, m, k) = list(map(int, input().split(' ')))
l = list(map(int, input().split(' ')))
pc = []
for i in range(len(l)):
	if l[i] != 0 and l[i] <= k and (i != m - 1):
		pc.append(i)
mi = len(l)
for i in pc:
	if abs(i - (m - 1)) <= mi:
		mi = abs(i + 1 - m)
print(abs(mi * 10))


information = input().split(' ')
quantHouses = int(information[0])
crush = int(information[1]) - 1
budget = int(information[2])
houses = input().split(' ')
minorDiff = quantHouses
for i in range(quantHouses):
	auxDiff = abs(crush - i)
	houseI = int(houses[i])
	if i != crush and houseI != 0 and (auxDiff < minorDiff) and (budget - houseI >= 0):
		minorDiff = auxDiff
print(minorDiff * 10)


(n, m, k) = input().split()
numberOfHouses = int(n)
girlHouse = int(m)
maxMoney = int(k)
PRICE_PER_HOUSE = 10
index = 0
housePrices = list(map(int, input().split()))
result = 101
for index in range(numberOfHouses):
	if housePrices[index] != 0 and housePrices[index] <= maxMoney:
		if abs(index + 1 - girlHouse) < result:
			result = abs(index + 1 - girlHouse)
print(result * PRICE_PER_HOUSE)


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
r1 = 0
for i in range(m, n):
	if l[i] <= k and l[i] != 0:
		r1 = i + 1 - m
		break
r2 = 0
for i in range(m - 2, -1, -1):
	if l[i] <= k and l[i] != 0:
		r2 = abs(m - i - 1)
		break
if r1 == 0:
	r = r2
elif r2 == 0:
	r = r1
else:
	r = min(r1, r2)
print(r * 10)


(n, m, k) = map(int, input().split())
arr = [int(x) for x in input().split()]
ans = 100000
m -= 1
for i in range(0, n):
	if arr[i] == 0 or arr[i] > k:
		continue
	else:
		ans = min(ans, abs(m - i))
print(ans * 10)


(n, m, k) = map(int, input().split())
l = [int(x) for x in input().split()]
a = 0
b = 0
flaga = 0
flagb = 0
for x in range(m - 1, 0, -1):
	a += 1
	if l[x - 1] <= k and l[x - 1] != 0:
		flaga = 1
		break
for y in range(m + 1, n + 1):
	b += 1
	if l[y - 1] <= k and l[y - 1] != 0:
		flagb = 1
		break
if flaga == 0:
	a = 101
if flagb == 0:
	b = 101
print(min(a, b) * 10)


(n, m, k) = map(int, input().split())
m -= 1
houses = list(map(int, input().split()))
leftDist = float('inf')
for i in range(m - 1, -1, -1):
	if houses[i] and houses[i] <= k:
		leftDist = min(leftDist, (m - i) * 10)
		break
rightDist = float('inf')
for i in range(m + 1, n):
	if houses[i] and houses[i] <= k:
		rightDist = min(rightDist, (i - m) * 10)
		break
print(min(leftDist, rightDist))


(n, b, c) = map(int, input().split())
a = list(map(int, input().split()))
d = []
for i in range(b):
	if a[i] != 0 and a[i] <= c:
		d.append((b - i - 1) * 10)
for i in range(b, len(a), 1):
	if a[i] != 0 and a[i] <= c:
		d.append((i - b + 1) * 10)
print(min(d))


info1 = input().split(' ')
casaMenina = int(info1[1]) - 1
dinheiro = int(info1[2])
casas = input().split(' ')
op = []
minimo = 100
for i in range(casaMenina - 1, -1, -1):
	if dinheiro >= int(casas[i]) and int(casas[i]) != 0:
		op.append(int(i))
		break
for j in range(casaMenina + 1, len(casas)):
	if dinheiro >= int(casas[j]) and int(casas[j]) != 0:
		op.append(j)
		break
for q in op:
	if minimo >= abs(casaMenina - q):
		minimo = casaMenina - q
print(abs(minimo) * 10)


(n, m, k) = map(int, input().split())
a = [*map(int, input().split())]
m -= 1
MAX = n + 1
for (i, e) in enumerate(a):
	if e != 0 and e <= k:
		if abs(i - m) < MAX:
			MAX = abs(i - m)
print(MAX * 10)


(n, m, k) = map(int, input().split())
casas = list(map(int, input().split()))
m = m - 1
distanciaMin = n + 1
for i in range(n):
	distancia = abs(m - i)
	if casas[i] > 0 and distancia <= distanciaMin and (casas[i] <= k):
		distanciaMin = distancia
print(distanciaMin * 10)


(n, m, k) = [int(x) for x in input().split()]
costs = [int(x) for x in input().split()]
ans = 10000000000
m = m - 1
for (index, cost) in enumerate(costs):
	if cost != 0 and cost <= k:
		ans = min(ans, abs(m - index))
print(ans * 10)


(n, m, k) = map(int, input().split())
houses = tuple(map(int, input().split()))
min_distance = float('inf')
for i in range(n):
	if houses[i] == 0:
		continue
	if i == m - 1:
		continue
	if houses[i] <= k:
		min_distance = min(min_distance, abs(m - 1 - i))
print(min_distance * 10)


(n, m, k) = map(int, input().split())
l = input()
l = [int(i) for i in l.split()]
m = m - 1
bef = l[:m][::-1]
af = l[m + 1:]
(t, tp, ti, tpi) = (0, 0, 0, 0)
for i in af:
	t += 1
	if i <= k and i != 0:
		ti = t * 10
		break
for i in bef:
	tp += 1
	if i <= k and i != 0:
		tpi = tp * 10
		break
if ti != 0 and tpi != 0:
	print(min(ti, tpi))
else:
	print(max(ti, tpi))


(n, m, k) = input().split()
home = input().split()
pos = int(m) - int(n)
prev = int(m) - int(n)
for i in range(int(m), int(n)):
	if int(home[i]) > 0 and int(home[i]) <= int(k):
		pos = i + 1
		break
for i in range(int(m) - 1, -1, -1):
	if int(home[i]) > 0 and int(home[i]) <= int(k):
		prev = i + 1
		break
print(min(abs(int(m) - pos), abs(int(m) - prev)) * 10)


import math
(n, m, k) = input().split(' ')
houses = input().split(' ')
index = math.inf
for i in range(int(n)):
	if i != int(m) - 1 and int(houses[i]) != 0:
		if int(houses[i]) <= int(k):
			if abs(int(m) - 1 - i) < index:
				index = abs(int(m) - 1 - i)
print(index * 10)


def main():
	nmk = input().split()
	n = int(nmk[0])
	m = int(nmk[1]) - 1
	k = int(nmk[2])
	houses = input().split()
	min = n
	for i in range(n):
		if 0 < int(houses[i]) <= k:
			if abs(i - m) < min:
				min = abs(i - m)
	print(min * 10)
	pass
main()


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = float('inf')
for i in range(m - 2, -1, -1):
	if a[i] != 0 and a[i] <= k:
		ans = m - (i + 1)
		break
for i in range(m, n):
	if a[i] != 0 and a[i] <= k:
		ans = min(ans, i - m + 1)
print(ans * 10)


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 11 ** 11
for i in range(n):
	if i == m - 1 or l[i] > k or l[i] == 0:
		continue
	if abs(m - 1 - i) < ans:
		ans = abs(m - 1 - i)
print(ans * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
min_r = 999999
for j in range(n):
	if j == m - 1:
		continue
	if a[j] != 0 and a[j] <= k and (abs(j + 1 - m) < min_r):
		min_r = abs(j + 1 - m)
print(10 * min_r)


x = [int(i) for i in input().split()]
(n, m, k) = (x[0], x[1] - 1, x[2])
x = [int(i) for i in input().split()]
y = []
z = [0] * n
for i in range(n):
	y.append(abs(i - m))
for i in range(n):
	if x[i] != 0 and x[i] <= k:
		z[i] = y[i]
print(10 * min(list(filter(lambda a: a != 0, z))))


(t, n, k) = list(map(int, input().split()))
costs = list(map(int, input().split()))
pos = []
for i in range(len(costs)):
	if 0 < costs[i] <= k:
		pos.append(i - (n - 1) if i > n - 1 else n - 1 - i)
print(min(pos) * 10)


(n, m, k) = map(int, input().split())
m = m - 1
arr = [int(inp) for inp in input().split()]
p1 = m - 1
p2 = m + 1
ans = 0
while p1 >= 0 or p2 < n:
	if p1 >= 0 and arr[p1] != 0 and (arr[p1] <= k):
		ans = abs(p1 - m) * 10
		break
	else:
		p1 -= 1
	if p2 < n and arr[p2] != 0 and (arr[p2] <= k):
		ans = abs(p2 - m) * 10
		break
	else:
		p2 += 1
print(ans)


(n, m, k) = list(map(int, input().split()))
houses = list(map(int, input().split()))
dist = 1
(i, j) = (m - 2, m)
while True:
	canBuyLeft = i >= 0 and 0 < houses[i] <= k
	canBuyRight = j < n and 0 < houses[j] <= k
	if canBuyLeft or canBuyRight:
		break
	dist += 1
	i -= 1
	j += 1
print(dist * 10)


yo = list(map(int, input().split()))
n = yo[0]
m = yo[1]
k = yo[2]
a = list(map(int, input().split()))
this = n
ans = 0
for i in range(n):
	if 0 < a[i] <= k and abs(i - (m - 1)) <= this:
		ans = i
		this = abs(i - (m - 1))
print(abs(ans - (m - 1)) * 10)


(n, m, k) = input().split()
price = [int(x) for x in input().split()]
distance = []
for i in range(int(n)):
	if price[i] > 0 and int(k) >= price[i]:
		distance.append(abs(i - int(m) + 1) * 10)
print(min(distance))


(n, m, k) = input().split()
n = int(n)
m = int(m)
k = int(k)
a = [int(x) for x in input().split()]
y = m - 2
dis1 = 0
dis2 = 0
l = 1
while y >= 0:
	if a[y] <= k and a[y] != 0:
		dis1 = l * 10
		break
	y -= 1
	l += 1
ll = 1
yy = m
while yy < n:
	if a[yy] <= k and a[yy] != 0:
		dis2 = ll * 10
		break
	yy += 1
	ll += 1
if dis1 == 0:
	dis1 = dis2
if dis1 > dis2 and dis2 != 0:
	dis1 = dis2
print(dis1)


(n, m, k) = input().split()
(n, m, k) = map(int, [n, m, k])
A = []
s = input()
a = 1
Min = 1000
for i in s.split():
	if int(i) <= k and int(i) != 0:
		x = abs(m - a)
		if x < Min:
			Min = x
	a = a + 1
print(Min * 10)


(n, m, k) = [int(i) for i in input().split()]
s = [int(i) for i in input().split()]
ans = 10000000000
for i in range(n):
	if s[i] <= k and s[i]:
		ans = min(ans, 10 * abs(m - 1 - i))
print(ans)


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
p = m - 1
o = m - 1
while True:
	o -= 1
	p += 1
	try:
		if l[p] != 0 and l[p] <= k:
			print((p - (m - 1)) * 10)
			break
	except:
		pass
	try:
		if l[o] != 0 and l[o] <= k and (o >= 0):
			print((m - 1 - o) * 10)
			break
	except:
		pass


def solve():
	(n, m, k) = map(int, input().split())
	houses = map(int, input().split())
	m -= 1
	cur_dist = n + 1
	cur_price = 0
	for (i, h) in enumerate(houses):
		dist = abs(m - i)
		if h != 0:
			if h <= k:
				if dist < cur_dist:
					cur_dist = dist
					cur_price = h
				elif dist == cur_dist:
					cur_price = min(h, cur_price)
	print(cur_dist * 10)
solve()


(n, m, k) = input().split()
n = int(n)
m = int(m) - 1
k = int(k)
a = list(map(int, input().split()))
a = list(map(lambda i: (i, a[i]), range(len(a))))
a = sorted(a, key=lambda x: x[1])
dist = len(a)
for i in range(n):
	if a[i][1] == 0:
		continue
	if a[i][1] <= k:
		if abs(a[i][0] - m) < dist:
			dist = abs(a[i][0] - m)
print(dist * 10)


nmk = input().split(' ')
for i in range(len(nmk)):
	nmk[i] = int(nmk[i])
m = nmk[1]
k = nmk[2]
prices = input().split(' ')
for i in range(len(prices)):
	prices[i] = int(prices[i])
avail_houses = list()
for i in range(len(prices)):
	if prices[i] != 0 and k >= prices[i]:
		avail_houses.append(i + 1)
min_dist = len(prices)
for h in avail_houses:
	if h - m < min_dist:
		min_dist = abs(h - m)
print(min_dist * 10)


def solution(l1, l2):
	(n, m, k) = (l1[0], l1[1], l1[2])
	i = 0
	while i < len(l2):
		if l2[i] > 0 and l2[i] <= k:
			l2[i] = 1
		else:
			l2[i] = 0
		i += 1
	i = 0
	d = []
	while i < len(l2):
		if l2[i] > 0:
			d.append(abs(m - 1 - i))
		i += 1
	ans = min(d) * 10
	return ans

def answer():
	l1 = [int(x) for x in input().split()]
	l2 = [int(x) for x in input().split()]
	print(solution(l1, l2))
answer()


(n, m, k) = input().split()
n = int(n)
m = int(m)
k = int(k)
S = []
L = [int(x) for x in input().split()]
for i in range(len(L)):
	if L[i] != 0 and L[i] <= k:
		L[m - 1]
		y = abs(i - (m - 1)) * 10
		S.append(y)
print(min(S))


input1 = input()
input2 = input()
input1_l = input1.split()
input2_l = input2.split()
n = int(input1_l[0])
m = int(input1_l[1])
k = int(input1_l[2])
counter = 999999999999
for i in range(0, n):
	if int(input2_l[i]) <= k and int(input2_l[i]) != 0:
		if abs(i - (m - 1)) < counter:
			counter = abs(i - (m - 1))
print(10 * counter)


(r, c, p) = list(map(int, input().split()))
pl = list(map(int, input().split()))
kjl = []
if c - 1 != 0 and c != r:
	tam = pl[0:c]
	tam = tam[::-1]
	for item in tam:
		if item <= p and item != 0:
			tod = tam.index(item)
			kjl.append(tod)
			break
	for item in pl[c - 1:]:
		if item <= p and item != 0:
			tod = pl[c - 1:].index(item)
			kjl.append(tod)
			break
	print(min(kjl) * 10)
elif c - 1 == 0:
	for item in pl:
		if item <= p and item != 0:
			tod = pl.index(item)
			print(tod * 10)
			break
else:
	pl = pl[::-1]
	for item in pl:
		if item <= p and item != 0:
			tod = pl.index(item)
			print(tod * 10)
			break


(n, m, k) = map(int, input().split())
houses = input()
houses = [int(x) for x in houses.split()]
m -= 1
buyleft = 300
buyright = 300
for i in range(m - 1, -1, -1):
	if houses[i] != 0 and houses[i] <= k:
		buyleft = i
		break
for i in range(m + 1, n):
	if houses[i] != 0 and houses[i] <= k:
		buyright = i
		break
left = m - buyleft
right = buyright - m
if buyleft != 300 and buyright != 300:
	if left < right:
		print(left * 10)
	else:
		print(right * 10)
elif buyleft == 300:
	print(right * 10)
else:
	print(left * 10)


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
x = 0
y = 0
i = m - 2
while i >= 0:
	if l[i] != 0 and l[i] <= k:
		x = (m - 1 - i) * 10
		break
	i = i - 1
i = m
while i < n:
	if l[i] != 0 and l[i] <= k:
		y = (i - (m - 1)) * 10
		break
	i = i + 1
if x != 0 and y != 0:
	if x < y:
		print(x)
	else:
		print(y)
elif y == 0:
	print(x)
elif x == 0:
	print(y)


d = 10

def love(n, m, k, l):
	r = []
	for i in range(n):
		if l[i] <= k and l[i] > 0:
			r.append(abs(i + 1 - m) * 10)
	return min(r)
(n, m, k) = list(map(int, input().strip().split(' ')))
l = list(map(int, input().strip().split(' ')))
print(love(n, m, k, l))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
flag1 = flag2 = 0
for i in range(m - 2, -1, -1):
	if a[i] != 0 and a[i] <= k:
		flag1 = 1
		break
for j in range(m, n):
	if a[j] != 0 and a[j] <= k:
		flag2 = 1
		break
if flag1 == 1 and flag2 == 1:
	print(min(m - i - 1, j - m + 1) * 10)
elif flag1 == 1 and flag2 == 0:
	print((m - i - 1) * 10)
else:
	print((j - m + 1) * 10)


(houses, girl_house, money) = [int(x) for x in input().split(' ')]
available = [int(x) for x in input().split(' ')]
cnt = 1
cheapest = 99 * 10
while cnt <= houses:
	if available[cnt - 1] == 0 or available[cnt - 1] > money:
		pass
	else:
		cheapest = min(cheapest, abs((cnt - girl_house) * 10))
	cnt += 1
print(cheapest)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
a.insert(0, 0)
if m == 1:
	for i in range(m, len(a)):
		if a[i] <= k and a[i] != 0:
			print((i - m) * 10)
			break
elif m == n:
	for i in range(m, 0, -1):
		if a[i] <= k and a[i] != 0:
			print((m - i) * 10)
			break
else:
	for i in range(m, len(a)):
		if a[i] <= k and a[i] != 0:
			ans1 = (i - m) * 10
			break
	else:
		ans1 = float('inf')
	for i in range(m, 0, -1):
		if a[i] <= k and a[i] != 0:
			ans2 = (m - i) * 10
			break
	else:
		ans2 = float('inf')
	print(min(ans1, ans2))


(num_houses, crush_house, Zane_money) = list(map(int, input().split()))
prices = list(map(int, input().split()))
crush_house -= 1
found = False
left_pos = crush_house - 1
right_pos = crush_house + 1
Zane_house = crush_house
while not found:
	if left_pos >= 0 and prices[left_pos] > 0 and (prices[left_pos] <= Zane_money):
		Zane_house = left_pos
		found = True
	elif right_pos < len(prices) and prices[right_pos] > 0 and (prices[right_pos] <= Zane_money):
		Zane_house = right_pos
		found = True
	left_pos -= 1
	right_pos += 1
Zane_house_distance = 0
if Zane_house > crush_house:
	Zane_house_distance = Zane_house - crush_house
else:
	Zane_house_distance = crush_house - Zane_house
Zane_house_distance *= 10
print(Zane_house_distance)


(n, m, k) = map(int, input().split())
A = list(map(int, input().split()))
mins = 10 ** 10
for i in range(len(A)):
	if i + 1 != m and k >= A[i] and (A[i] != 0):
		mins = min(abs(m - (i + 1)), mins)
print(10 * mins)


ch = input().split(' ')
n = int(ch[0])
m = int(ch[1])
k = int(ch[2])
a = input().split(' ')
d = 999999999
for i in range(n):
	if int(a[i]) != 0 and int(a[i]) <= k and (abs(i - m + 1) * 10 <= d):
		d = abs(i - m + 1) * 10
print(d)


(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
pos = m - 1
if pos == 0:
	dis = 0
	for i in range(1, n):
		if arr[i] == 0:
			dis += 10
			continue
		elif arr[i] > k:
			dis += 10
			continue
		elif arr[i] <= k:
			dis += 10
			break
	print(dis)
else:
	dis1 = 0
	dis = 0
	flag = 0
	flag1 = 0
	for i in range(pos - 1, -1, -1):
		if arr[i] == 0:
			dis += 10
			continue
		elif arr[i] > k:
			dis += 10
			continue
		elif arr[i] <= k:
			dis += 10
			flag = 1
			break
	for i in range(pos + 1, n):
		if arr[i] == 0:
			dis1 += 10
			continue
		elif arr[i] > k:
			dis1 += 10
			continue
		elif arr[i] <= k:
			dis1 += 10
			flag1 = 1
			break
	if flag == 1 and flag1 == 0:
		print(dis)
	elif flag == 0 and flag1 == 1:
		print(dis1)
	elif flag == 1 and flag == 1:
		print(min(dis, dis1))


def menorDistancia(precoCasas, m, k):
	i = 1
	distanciaEntreCasas = 10
	while True:
		if m - i >= 0:
			if int(precoCasas[m - i]) <= k and int(precoCasas[m - i]) > 0:
				break
		if m + i < len(precoCasas):
			if int(precoCasas[m + i]) <= k and int(precoCasas[m + i]) > 0:
				break
		i += 1
	return distanciaEntreCasas * i
entrada = input().split()
m = int(entrada[1])
k = int(entrada[2])
precoCasas = input().split()
print(menorDistancia(precoCasas, m - 1, k))


import sys
input = sys.stdin.readline
import math

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
(n, m, k) = invr()
li = inlt()
if m == 1:
	for i in range(n):
		if li[i] != 0 and li[i] <= k:
			print(i * 10)
			break
elif m == n:
	for i in range(1, n + 1):
		if li[-i] != 0 and li[-i] <= k:
			print((i - 1) * 10)
			break
else:
	ans1 = 10000
	ans2 = 10000
	pos = n - m + 1
	for i in range(m, n):
		if li[i] != 0 and li[i] <= k:
			ans1 = (i + 1 - m) * 10
			break
	for i in range(pos + 1, n + 1):
		if li[-i] != 0 and li[-i] <= k:
			ans2 = (i - pos) * 10
			break
	print(min(ans1, ans2))


(a, b, c) = (int(x) for x in input().split())
casas = []
for l in input().split():
	casas.append(int(l))
possiveis = []
for n in range(0, a):
	if c >= casas[n] and casas[n] != 0:
		possiveis.append(n + 1)
real = []
for d in possiveis:
	real.append(abs(b - d))
pos = min(real)
dist = pos * 10
print(dist)


def buy(prices, house_index, budget):
	distance1 = None
	distance2 = None
	result = None
	for index in range(house_index - 1, -1, -1):
		price = prices[index]
		if price > 0 and price <= budget:
			distance1 = house_index - index
			break
	for index in range(house_index + 1, len(prices)):
		price = prices[index]
		if price > 0 and price <= budget:
			distance2 = index - house_index
			break
	if distance1 != None and (distance2 == None or distance1 < distance2):
		result = distance1 * 10
	else:
		result = distance2 * 10
	return result
(houses, house_index, budget) = map(int, input().split())
prices = list(map(int, input().split()))
result = buy(prices, house_index - 1, budget)
print(result)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
	if a[i] and a[i] <= k:
		b.append(abs(m - i - 1))
x = min(b) * 10
print(x)


(n, m, k) = map(int, input().split())
price = list(map(int, input().split()))
d1 = 300
d2 = 300
for i in range(m - 2, -1, -1):
	if price[i] <= k and price[i] != 0:
		d1 = i + 1
		break
for i in range(m, n):
	if price[i] <= k and price[i] != 0:
		d2 = i + 1
		break
print(min(abs(d2 - m), abs(m - d1)) * 10)


import math
(n, m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
listmin = [abs(m - 1 - i) for i in range(n) if a[i] != 0 and a[i] <= k and (i != m - 1)]
print(min(listmin) * 10)


ml = input().split()
n = int(ml[0])
m = int(ml[1])
k = int(ml[2])
arr = [int(x) for x in input().split()]
s1 = 10000000
s2 = 10000000
for i in range(m - 1, n, 1):
	if k >= arr[i] and arr[i] != 0:
		s1 = i - m + 1
		break
for i in range(m - 1, -1, -1):
	if k >= arr[i] and arr[i] != 0:
		s2 = m - 1 - i
		break
s3 = min(s1, s2)
s3 *= 10
print(s3)


from math import inf

def solve(n, m, k, a):
	ans = inf
	m -= 1
	for i in range(n):
		if a[i] and a[i] <= k and (abs(m - i) < ans):
			ans = abs(m - i)
	return ans * 10

def main():
	(n, m, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	print(solve(n, m, k, a))
main()


(n, m, k) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
res = 100000000.0
m -= 1
for i in range(n):
	if a[i] == 0:
		continue
	dist = abs(m - i)
	if a[i] <= k:
		res = min(res, 10 * dist)
print(res)


(num, girl_index, money) = map(int, input().split())
house_prices = list(map(int, input().split()))
min_distance = num
girl_index -= 1
if 0 < girl_index < len(house_prices) - 1:
	(l, r) = (girl_index - 1, girl_index + 1)
	final_index = 0
	while True:
		if 0 < house_prices[l] <= money:
			final_index = l
			break
		elif 0 < house_prices[r] <= money:
			final_index = r
			break
		else:
			if l > 0:
				l -= 1
			if r < len(house_prices) - 1:
				r += 1
elif girl_index == len(house_prices) - 1:
	l = girl_index - 1
	final_index = 0
	while True:
		if 0 < house_prices[l] <= money:
			final_index = l
			break
		elif l > 0:
			l -= 1
else:
	r = girl_index + 1
	final_index = 0
	while True:
		if 0 < house_prices[r] <= money:
			final_index = r
			break
		elif r < len(house_prices) - 1:
			r += 1
print(abs(girl_index - final_index) * 10)


(n, p, k) = list(map(int, input().strip().split()))
l = list(map(int, input().strip().split()))
t = l[:p - 1]
t = t[::-1]
c = l[p:]
q = len(t)
w = len(c)
if q < w:
	for i in range(q):
		if t[i] != 0 and t[i] <= k:
			print((i + 1) * 10)
			break
		elif c[i] != 0 and c[i] <= k:
			print((i + 1) * 10)
			break
	else:
		for j in range(q, w):
			if c[j] != 0 and c[j] <= k:
				print((j + 1) * 10)
				break
elif w < q:
	for i in range(w):
		if t[i] != 0 and t[i] <= k:
			print((i + 1) * 10)
			break
		elif c[i] != 0 and c[i] <= k:
			print((i + 1) * 10)
			break
	else:
		for j in range(w, q):
			if t[j] != 0 and t[j] <= k:
				print((j + 1) * 10)
				break
else:
	for i in range(w):
		if t[i] != 0 and t[i] <= k:
			print((i + 1) * 10)
			break
		elif c[i] != 0 and c[i] <= k:
			print((i + 1) * 10)
			break


import sys, re, array, math, functools
input = lambda : sys.stdin.readline()

@functools.lru_cache(maxsize=10000000)
def Main():
	(n, m, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	ans = n
	for i in range(n):
		if arr[i] > 0 and arr[i] <= k:
			ans = min(ans, abs(i - (m - 1)))
	print(ans * 10)
Main()


(a, b, c) = map(int, input().split())
l = list(map(int, input().split()))
for x in range(1, a):
	if b - 1 - x >= 0 and 0 < l[b - 1 - x] <= c:
		print(10 * x)
		break
	elif b - 1 + x < a and 0 < l[b - 1 + x] <= c:
		print(10 * x)
		break


(n, m, t) = map(int, input().split(' '))
l = list(map(int, input().split(' ')))
count = 0
total = 0
i = m - 2
j = m
while i >= 0 or j <= n - 1:
	S = 1
	L = 1
	if i >= 0:
		count = count + 10
		if l[i] > 0 and l[i] <= t:
			S = 0
		i = i - 1
	if j <= n - 1:
		total = total + 10
		if l[j] > 0 and l[j] <= t:
			L = 0
		j = j + 1
	if L == 0 and S == 0:
		if count <= total:
			print(count)
			break
		else:
			print(total)
			break
	elif L == 0:
		print(total)
		break
	elif S == 0:
		print(count)
		break


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(0, n):
	if a[i] <= k and a[i] != 0:
		b.append(i + 1)
mi = n
for i in b:
	if abs(m - i) < mi:
		mi = abs(m - i)
print(mi * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
	if a[i] and a[i] <= k:
		a[i] = abs(i - m + 1)
	else:
		a[i] = 100
print(min(a) * 10)


(n, m, k) = map(int, input().split())
p = list(map(int, input().split()))
s = t = 100000
for i in range(m):
	if int(p[m - 1 - i]) != 0 and int(p[m - 1 - i]) <= k:
		s = i * 10
		break
for j in range(n - m + 1):
	if int(p[m + j - 1]) != 0 and int(p[m + j - 1]) <= k:
		t = j * 10
		break
print(min(s, t))


__author__ = 'Daniel Mitre'
(n, m, k) = map(int, input().split())
prices = map(int, input().split())

def dist_to_girl(pos: int) -> int:
	return abs(pos - m)
buy = float('inf')
for (idx, price) in zip(range(1, n + 1), prices):
	if price > 0 and price <= k and (dist_to_girl(idx) < dist_to_girl(buy)):
		buy = idx
print(dist_to_girl(buy) * 10)


(n, m, k) = map(int, input().split())
a = [0] * n
a = list(map(int, input().split()))
c = 10000
m = m - 1
for i in range(n):
	if a[i] > 0 and a[i] <= k:
		if c > m - i and m - i > 0:
			c = m - i
		elif c > i - m and i - m > 0:
			c = i - m
print(10 * c)


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
(n, m, k) = R()
a = L()
m -= 1
ans = math.inf
for i in range(n):
	if m + i < n and 0 < a[m + i] <= k:
		ans = min(ans, i * 10)
	if m - i >= 0 and 0 < a[m - i] <= k:
		ans = min(ans, i * 10)
print(ans)


def roi(b, k):
	d = 101
	for i in range(len(b)):
		if b[i] <= k and b[i] != 0:
			d = b.index(b[i]) + 1
			break
	return d
(n, m, k) = map(int, input().split())
a = [int(i) for i in input().split()]
g = m - 1
d = 0
if g == 0:
	q = roi(a[g + 1:], k)
	print(10 * q)
elif g == n - 1:
	h = a[:g]
	h.reverse()
	q = roi(h, k)
	print(10 * q)
elif g != 0 and g != n - 1:
	j = a[:g]
	j.reverse()
	s = roi(j, k)
	p = roi(a[g + 1:], k)
	if s < p:
		print(s * 10)
	elif s > p:
		print(p * 10)
	else:
		print(p * 10)


from sys import stdin, stdout

def solve(numberHouses, location, budget, prices):
	distance = 10
	i = 1
	while True:
		condition1 = location - 1 - i >= 0 and prices[location - 1 - i] <= budget and (prices[location - 1 - i] != 0)
		condition2 = location - 1 + i < numberHouses and prices[location - 1 + i] <= budget and (prices[location - 1 + i] != 0)
		if condition1 or condition2:
			return distance
		distance += 10
		i += 1
(numberHouses, location, budget) = [int(x) for x in stdin.readline().rstrip('\r\n').split()]
prices = [int(x) for x in stdin.readline().rstrip('\r\n').split()]
stdout.write(str(solve(numberHouses, location, budget, prices)))


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
min = 10000
m -= 1
for i in range(len(a)):
	if a[i] != 0 and a[i] <= k and (abs(m - i) < min):
		min = abs(m - i)
	else:
		pass
print(min * 10)


(n, m, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
d = 1
g = 0
while g == 0:
	if m - d > 0:
		g += k >= l[m - d - 1] > 0
	if m + d < n + 1:
		g += k >= l[m + d - 1] > 0
	if g == 0:
		d += 1
print(d * 10)


(n, m, k) = map(int, input().split())
v = list(map(int, input().split()))
x = []
for i in range(n):
	if v[i] <= k and v[i] != 0:
		x.append(abs(m - 1 - i) * 10)
x.sort()
print(x[0])


(n, m, k) = map(int, input().split(' '))
list0 = list(map(int, input().split(' ')))
distances = []
for i in range(n):
	if list0[i] <= k and list0[i] != 0:
		distances.append(10 * abs(m - i - 1))
print(min(distances))


(n, m, k) = map(int, input().split())
l = list(map(int, input().split()))
m -= 1
t1 = m - 1
t2 = m + 1
ans = n
while t1 >= 0:
	if l[t1] != 0 and l[t1] <= k:
		ans = min(ans, m - t1)
		break
	t1 -= 1
while t2 <= n - 1:
	if l[t2] != 0 and l[t2] <= k:
		ans = min(ans, t2 - m)
		break
	t2 += 1
ans *= 10
print(ans)


p = list(map(int, input().split()))
t = list(map(int, input().split()))
min = p[0]
for i in range(p[0]):
	if t[i] != 0 and t[i] <= p[2] and (abs(p[1] - i - 1) < min):
		min = abs(p[1] - i - 1)
		h = i + 1
print(abs((h - p[1]) * 10))


variables = input().split(' ')
houses = input().split(' ')
girl = int(variables[1]) - 1
house = 0
min_distance = abs(len(houses))
for n in range(len(houses)):
	if int(houses[n]) <= int(variables[2]) and int(houses[n]) > 0:
		if abs(n - girl) < min_distance:
			min_distance = abs(n - girl)
			house = n
print(abs(house - girl) * 10)


(numHouses, girlsHouse, moneyAvailable) = [int(n) for n in input().split()]
houses = [int(n) for n in input().split()]
i = 1
girlsHouse -= 1
for num in range(numHouses):
	leftIndex = girlsHouse - i
	rightIndex = girlsHouse + i
	if leftIndex >= 0:
		left = houses[leftIndex]
		if left <= moneyAvailable and left != 0:
			print(i * 10)
			quit()
	if rightIndex < numHouses:
		right = houses[rightIndex]
		if right <= moneyAvailable and right != 0:
			print(i * 10)
			quit()
	i += 1


import sys
DISTANCE_FACTOR = 10

def toInteger(inputs):
	return list(map(int, inputs))
(num_houses, position, budget) = toInteger(input().split())
values = toInteger(input().split())
minimum_distance = sys.maxsize
position -= 1

def getDistance(a, b):
	start = max(a, b)
	finish = min(a, b)
	return DISTANCE_FACTOR * (start - finish)
for pos in range(len(values)):
	value = values[pos]
	if value != 0 and value <= budget and (pos != position):
		distance = getDistance(pos, position)
		minimum_distance = min(minimum_distance, distance)
print(minimum_distance)


import sys
(n, m, k) = map(int, input().split())
an = list(map(int, sys.stdin.readline().split()))
ans = 0
m -= 1
while True:
	ans += 1
	p = m - ans
	if p >= 0 and an[p] > 0 and (k >= an[p]):
		break
	p = m + ans
	if p < n and an[p] > 0 and (k >= an[p]):
		break
print(10 * ans)


(n, m, k) = [int(s) for s in input().split(' ')]
a = [int(s) for s in input().split(' ')]
print(10 * min([abs(m - 1 - j) for (j, p) in enumerate(a) if 0 < p <= k]))


q = list(map(int, input().split()))
n = q[0]
m = q[1] - 1
k = q[2]
a = input().split(' ')
for t in range(1, n):
	if m - t >= 0 and int(a[m - t]) != 0 and (int(a[m - t]) <= k):
		print(t * 10)
		break
	elif t + m < n and int(a[m + t]) != 0 and (int(a[m + t]) <= k):
		print(t * 10)
		break


def main():
	(n, m, k) = map(int, input().split())
	m -= 1
	a = list(map(int, input().split()))
	min_dist = n
	for (i, ai) in enumerate(a):
		if ai != 0 and ai <= k:
			min_dist = min(min_dist, abs(i - m))
	print(min_dist * 10)
main()


(n, m, k) = map(int, input().split())
home = list(map(int, input().split()))
(Min, index) = (999999, 0)
for i in range(n):
	if home[i] != 0 and home[i] <= k:
		Min = min(abs(i + 1 - m) * 10, Min)
print(Min)


(n, m, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
m -= 1
r = 1000000
for (i, x) in enumerate(a):
	if 0 < x <= k:
		r = min(r, abs(i - m) * 10)
print(r)


from sys import stdin
(n, m, k) = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]
m = m - 1
minDistance = 2000
for i in range(n):
	if a[i] != 0 and a[i] <= k and (i != m):
		tempDistance = abs(i - m) * 10
		if tempDistance < minDistance:
			minDistance = tempDistance
print(minDistance)


(n, m, k) = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
minn = 1000
for i in range(n):
	if arr[i] <= k and arr[i] != 0:
		if abs(i + 1 - m) < minn:
			minn = abs(i + 1 - m)
print(minn * 10)


(n, m, k) = map(int, input().split())
prices = [int(price) for price in input().split()]
left = right = n ** 5
m -= 1
i = m - 1
while i >= 0:
	if 0 < prices[i] <= k:
		left = m - i
		break
	i -= 1
i = m + 1
while i < n:
	if 0 < prices[i] <= k:
		right = i - m
		break
	i += 1
result = 10 * min(left, right)
print(result)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	(a, b, c) = LI()
	ll = LI()
	b -= 1
	l = r = b
	while True:
		l -= 1
		r += 1
		if 0 <= l:
			if ll[l] != 0 and ll[l] <= c:
				return (b - l) * 10
		if r < a:
			if ll[r] != 0 and ll[r] <= c:
				return (r - b) * 10
print(main())


(n, m, k) = map(int, input().split())
s = list(map(int, input().split()))
i = 1
while True:
	if i < m:
		if s[m - 1 - i] != 0 and k >= s[m - 1 - i]:
			break
	if i < n - m + 1:
		if s[m - 1 + i] != 0 and k >= s[m - 1 + i]:
			break
	i = i + 1
print(10 * i)


(n, m, k) = list(map(int, input().split()))
house = list(map(int, input().split()[:n]))
crush = m - 1
distance = []
for i in range(len(house)):
	if house[i] == 0:
		continue
	elif house[i] > k:
		continue
	else:
		d = max(i - crush, crush - i) * 10
		distance.append(d)
print(min(distance))


(N, M, K) = map(int, input().strip().split())
P = [int(p) for p in input().strip().split()]
left = None
for i in range(M - 2, -1, -1):
	if P[i] > K or P[i] == 0:
		continue
	distance = M - 1 - i
	left = (distance, P[i])
	break
right = None
for i in range(M, N):
	if P[i] > K or P[i] == 0:
		continue
	distance = i - M + 1
	right = (distance, P[i])
	break
if not left and (not right):
	print(-1)
elif left and (not right):
	print(left[0] * 10)
elif not left and right:
	print(right[0] * 10)
elif left[0] > right[0]:
	print(right[0] * 10)
elif left[0] < right[0]:
	print(left[0] * 10)
elif left[1] > right[1]:
	print(left[0] * 10)
else:
	print(right[0] * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
m -= 1
l = m - 1
r = m + 1
while True:
	if l >= 0 and a[l] != 0 and (a[l] <= k):
		print((m - l) * 10)
		exit()
	if r < n and a[r] != 0 and (a[r] <= k):
		print((r - m) * 10)
		exit()
	l -= 1
	r += 1


(n, m, k) = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
minp = 101
for (i, p) in enumerate(a):
	if p > 0 and p <= k:
		temp = abs(m - i - 1)
		if temp < minp:
			minp = temp
print(minp * 10)


inp = lambda : map(int, input().split())
(n, m, k) = inp()
m -= 1
a = list(inp())
l = 500
r = 500
for i in range(m, n):
	if a[i] <= k and a[i] != 0:
		r = i - m
		break
for i in range(m, -1, -1):
	if a[i] <= k and a[i] != 0:
		l = m - i
		break
print(min(l, r) * 10)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(n, m, k) = LI()
	a = LI()
	r = inf
	for i in range(n):
		if a[i] == 0 or a[i] > k:
			continue
		t = abs(m - 1 - i)
		if r > t:
			r = t
	return r * 10
print(main())


(n, m, k) = [int(c) for c in input().split()]
res = n * 10
for (i, p) in enumerate((int(c) for c in input().split())):
	d = abs(i + 1 - m) * 10
	if p <= k and p != 0 and (d < res):
		res = d
print(res)


(n, m, k) = input().split()
n = int(n)
m = int(m)
k = int(k)
h = input().split()
no_zero = 0
for i in range(len(h)):
	h[i] = int(h[i])
	if h[i] > k:
		h[i] = 0
	elif h[i] != 0:
		no_zero += 1
min_dis = None
while no_zero:
	c = max(h)
	i = h.index(c) + 1
	if min_dis is None or min_dis > abs(i - m):
		min_dis = abs(i - m)
	no_zero -= 1
	h[i - 1] = 0
print(min_dis * 10)


(n, m, k) = map(int, input().split())
arr = list(map(int, input().split()))
for i in range(n):
	if m + i <= n and arr[m + i - 1] in range(1, k + 1):
		print(i * 10)
		exit()
	if m - i > 0 and arr[m - i - 1] in range(1, k + 1):
		print(i * 10)
		exit()


(n, m, k) = map(int, input().split())
ar = list(map(int, input().split()))
c = m - 1
count = 0
count1 = []
for i in range(n):
	if ar[i] <= k and ar[i] != 0:
		count1.append(abs(i - c))
print(min(count1) * 10)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
lst = []
for x in range(n):
	if a[x] > 0 and a[x] <= k:
		lst.append(abs(m - 1 - x))
print(min(lst) * 10)


(n, m, k) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
m -= 1
p1 = m
for i in range(m - 1, -1, -1):
	if 0 < a[i] <= k:
		p1 = i
		break
p2 = m
for i in range(m + 1, n):
	if 0 < a[i] <= k:
		p2 = i
		break
p = n + 1
if m - p1 > 0:
	p = m - p1
if p2 - m > 0 and p2 - m < p:
	p = p2 - m
print(10 * p)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
minlen = 200
for i in range(n):
	if a[i] > 0 and a[i] <= k:
		if abs(m - 1 - i) < minlen:
			minlen = abs(m - 1 - i)
print(minlen * 10)


(n, m, k) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
m -= 1
i = m + 1
one = -1
two = -1
ans = -1
while i < n:
	if a[i] <= k and a[i] != 0:
		one = abs(i - m) * 10
		break
	i += 1
i = m - 1
while i >= 0:
	if a[i] <= k and a[i] != 0:
		two = abs(i - m) * 10
		break
	i -= 1
if one != -1:
	ans = one
if two != -1:
	if ans == -1:
		ans = two
	else:
		ans = min(ans, two)
print(ans)


(n, m, k) = map(int, input().split())
a = list(map(int, input().split()))
result = 1000
for i in range(n):
	dist = abs(i - m + 1) * 10
	if 0 < a[i] <= k and dist < result:
		result = dist
print(result)