Zane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us.  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 a1, a2, ..., an that denote the availability and the prices of the houses. If house i is occupied, and therefore cannot be bought, then ai equals 0. Otherwise, house i can be bought, and ai 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.

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 a1, a2, ..., an (0 ≤ ai ≤ 100) — denoting the availability and the prices of the houses. It is guaranteed that am = 0 and that it is possible to purchase some house with no more than k dollars.

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

NoteIn 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.

#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, m, k, arr[100];
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    m--;
    int mn = 2147483647;
    for (int i = m; i >= 0; i--)
        if (arr[i] > 0 && arr[i] <= k)
        {
            mn = min(mn, m - i);
            break;
        }
    for (int i = m; i < n; i++)
        if (arr[i] > 0 && arr[i] <= k)
        {
            mn = min(mn, i - m);
            break;
        }
    cout << mn * 10 << '\n';
    return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int n,m,k;
    cin >> n >> m >> k;
    int a[n];
    for (int i=0; i<n ;i++)
        cin >> a[i];
    int found = 1;
    int tr=0,i=1,j=1;
    while (found == 1)
    {
        if (tr%2==0)
        {
            if ((m-1+i)<n)
            {
                if (a[m-1+i]!=0)
                {
                    if (a[m-1+i]<=k)
                    {
                        cout << 10*i;
                        found = 0;

                    }
                }
            }
            else if ((m-1-j)<0)
                break;

        i++;
        }
        if (tr%2!=0)
        {
            if ((m-1-j)>=0)
            {
                if (a[m-1-j]!=0)
                {
                    if (a[m-1-j]<=k)
                    {
                        cout << 10*j;
                        found = 0;

                    }
                }
            }
            else if ((m-1+i)>n)
            break;

        j++;
        }
        tr++;
    }

}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,m,k;
    int arr[10000];
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
    }
    int left=0,right=0,count1=10,count2=10;
    for(int i=m-1;i>=1;i--)
    {
        if(arr[i]!=0)
        {
            if(arr[i]<=k)
            {
                left=count1;
                break;
            }
        }
        count1+=10;
    }
    for(int i=m+1;i<=n;i++)
    {
        if(arr[i]!=0)
        {
            if(arr[i]<=k)
            {
                right=count2;
                break;
            }
        }
        count2+=10;
    }
   if(left == 0)
   {
       cout<<right;
   }
   else if(right==0)
   {
       cout<<left;
   }
   else
   {
       if(left<=right)
       {
           cout<<left;
        }
        else
        {
            cout<<right;

        }
   }
   return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, m, k; cin>>n>>m>>k;
	int a[n], res=INT_MAX;

	for(int i=1; i<=n; i++){
		cin>>a[i];
		}
		for(int i=1; i<=n; i++){
		if(a[i]<=k && a[i]!=0 ){
			//cout<<i<<" ";
			res=min(abs(i-m), res);
			//cout<<abs(i-m)<<" ";
			//cout<<(res)<<" ";
			//return 0;
		}

	}
	cout<<res*10;
	return 0;
}

#include<iostream>
#include<cmath>

using namespace std;
int main()
{
    int n,m,j=0,mini,k;
    cin>>n>>m>>k;
    int a[101];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]<=k && a[i]!=0)
        {
            a[j]=(m-1)-i;
            if(a[j]<0)
            {
                a[j]=-a[j];
            }
            j++;
        }
    }
    mini=a[0];
    for(int i=1;i<j;i++)
    {
        if(a[i]<mini)
        {
            mini=a[i];
        }
    }
    cout<<10*mini<<endl;
    return 0;
}

#include<iostream>
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

int main(){
    ll n,m,k,i,val;
    cin>>n>>m>>k;
    ll mn=INT_MAX;
    for(i=1;i<=n;i++){
        cin>>val;
        if(val>0 && val<=k && i!=m)
         mn=min(mn,abs(i-m));
    }

    cout<<mn*10<<endl;
}

/* (: Sreejith Codes :) */

#include    <bits/stdc++.h>

#define 	ll 	long long
#define 	ld 	long double
#define 	pb 	push_back
#define 	ff 	first
#define 	ss 	second
#define 	mp 	make_pair
#define 	pi 	3.141592653589793
#define 	ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

int main()
{
	ios;
	ll n,k,r,c=0,a=1000000,b=1000000000,bb;
	cin>>n>>k>>r;
	vector < ll > v;
	v.pb(0);
	for(ll i = 0 ; i < n ; i++ )
	{
		cin>>bb;
		v.pb(bb);
	}
	for(ll i=k-1 ; i >=1 ; i--)
	{
		c++;
		if(v[i]!=0)
		{
			if(v[i]<=r)
			{
				a=c;
				break;
			}

		}
	}

	c=0;
	for(ll i=k+1 ; i <= n ; i++)
	{
		c++;
		if(v[i]!=0)
		{
			if(v[i]<=r)
			{
				b=c;
				break;
			}
		}
	}

	c=min(a,b);
	c*=10;
	cout<<c;

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif // ONLINE_JUDGE

	long long int n,m,k,i,a[500],flag = 0,flag1 = 0,pos,pos1;
	cin >> n >> m >> k;

	for(i = 0;i<n;i++)
	{
		cin >> a[i];
	}

	for(i = m;i<n;i++)
	{
		if(a[i]!=0 && a[i]<=k)
		{
			flag = 1;
			pos = i;
			break;
		}
	}

	for(i = m;i >=0;i--)
	{
		if(a[i]!=0 && a[i]<=k)
		{
			flag1 = 1;
			pos1 = i;
			break;
		}
	}

	if(flag != 1)
	{
		cout<<abs((m-pos1-1)*10);
	}
	else if(flag1 != 1)
	{
		cout<<abs((m-pos-1)*10);
	}
	else
	{

		if(abs(m-pos1-1) < abs(m-pos-1))
		{
			cout<<abs((m-pos1-1)*10);
		}
		else
		{
			cout<<abs((m-pos-1)*10);

		}
	}

}

#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n, m, k, a[100];
	cin >> n >> m >> k;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	/////////////////////////////
	int r = 100, l = 100;
	for(int i=m;i<n;++i)
		if (a[i] <= k && a[i] != 0) {
			r = i - m + 1;
			break;
		}
	for(int i=m-2;i>=0;--i)
		if (a[i] <= k && a[i] != 0) {
			l = m - i - 1;
			break;
		}
	cout << min(l, r) * 10;
	return 0;
}

#include<bits/stdc++.h>

using namespace std;
int a[1500];
int b[1500];
int main()
{
    int n,m,r,mn=10000,mx=0,K=0,ans=9999;
    cin>>n>>m>>r;
    m--;
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for (int i=m+1;i<n;i++)
    {
        if (r>=a[i]&&a[i])
            ans=min(ans,i-m);
    }
    for (int i=m-1;i>=0;i--)
    {
        if (r>=a[i]&&a[i])
            ans=min(ans,m-i);
    }
    cout<<ans*10<<endl;
    return 0;
}

#include <bits/stdc++.h>

const long long mxn = 1e5 + 7;

using namespace std;

int main(){
    long long n, m, k, a[mxn], cnt = 0, sum = 0, c = 0, p = 0;
    cin >> n >> m >> k;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(a[i] == 0){
            a[i] = k + 1;
        }
     }
     for(int i = m - 1; i >= 1; i--){
        if(a[i] > k){
            sum++;
        }
        else {
                p++;
            break;
        }
     }
     for(int i = m + 1; i <= n; i++){
        if(a[i] > k){
            cnt++;
        }
        else {
            c++;
            break;
        }
     }
     if(c == 1 && p == 1){
        cout << (min(cnt, sum) + 1) * 10;
        return 0;
     }
     if(c == 0){
        cout << (sum + 1) * 10;
        return 0;
     }
     if(p == 0){
        cout << (cnt + 1) * 10;
        return 0;
     }
}

#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[10000];
int main() {
	cin >> n >> m >> k;
	int ans = n + 1;
	m--;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] != 0 && a[i] <= k) {
			ans = min(ans, abs(m - i));
		}
	}
	cout << ans * 10 << endl;
}

//gcc 5.4.0

#include  <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	string str;
	int n, m, d, k,b, rub, res, mm;
	vector<int> a;

	cin >> n >> mm >> k;

m=mm-1;
	for(int i=0; i< n; i++)
	{
		cin >> rub;

		a.push_back(rub);

	}

	int i = m-1;
	int j = m+1;
	while(1)
	{
		if(i >=0 && a[i] > 0 && a[i] <= k)
		{
			res = (m-i)*10;
			break;
		}
		if(j < n && a[j] > 0 && a[j] <= k)
		{
			res = (-m+j)*10;
			break;
		}
		i--;
		j++;

	}
cout << res;

getchar();
getchar();
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,p,k;
    cin >> n >> p >> k;
    --p;

    vector<int> a(n);
    for(auto& e:a) cin >> e;

    int i{p},j{p};
    while((a[i]>k||!a[i])&&--i>=0);
    while((a[j]>k||!a[j])&&++j<n);

    if(i==-1)
        cout << (j-p)*10;
    else if(j==n)
        cout << (p-i)*10;
    else
        cout << min(j-p,p-i)*10;
}

#include<bits/stdc++.h>

using namespace std;

int main()
{
  int n,m,k,a,ans=1e9;cin>>n>>m>>k;

  for(int i = 1;i<=n;i++)
  {
    cin>>a;
    if(a<=k&&a>0)
    {
        ans=min(ans,abs(m-i)*10);

    }

  }
cout<<ans;

  return 0;

}

#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 5;

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	int ans = N;
	for (int i = 1; i <= n; ++i)
	{
		int a;
		cin >> a;
		if (a > 0 and a <= k)
			ans = min(ans, 10 * abs(i - m));
	}
	cout << ans;
}

#include <iostream>

void main()
{
	int n,m,k;
	std::cin>>n>>m>>k;
	m--;

	int temp = 0, min = 10000;
	int value;

	for(int i = 0; i < n; i++)
	{
		std::cin>>temp;

		if(temp != 0)
		{
			if(temp <= k)
			{
				if(i < m)
					value = m - i;
				else
					value = i - m;
				min = std::min(min, value);
			}
		}
	}
	std::cout<<min * 10;
}

#include <iostream>
#include <cstdio>
using namespace std;
int a[10000];
int main()
{
	int n,m,k;
	cin>>n>>m>>k;

	int i;
	for(i = 1;i<=n;i++)
		scanf("%d",&a[i]);
	int flag = 0;
	int j = m;
	for(i = m+1;;i++)
	{
		if(j<1&&i>n)
			break;
		j--;
		if(j>0)
			if(a[j]<=k&&a[j]!=0)
			{
				flag = m-j;
				break;
			}
		if(a[i]<=k&&a[i]!=0&&flag==0)
		{
			flag = i-m;
			break;
		}
	}
	cout<<flag*10<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    int a[n];
    int i;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    m--;
    int j;
    i=m-1;
    j=m+1;
    int ans;
    while(1)
    {
        //cout<<i<<" "<<j<<" "<<n-1<<endl;
        if(i<0)
            i=0;
        if(j>n-1)
            j=n-1;
        if(a[i]&&a[j])
        {
            if(a[i]<=k&&a[j]<=k)
            {
              if(a[i]<a[j])
                    {
                        ans=i;
                        break;
                    }
              else
                {
                    ans=j;
                    break;
                }
            }
            else if(a[i]<=k)
            {
                ans=i;
                break;
            }
            else if(a[j]<=k)
            {
                ans=j;
                break;
            }
        }
        else if(a[i]&&a[i]<=k)
        {
            ans=i;
            break;
        }
        else if(a[j]&&a[j]<=k)
        {
            //cout<<"P"<<" ";
            ans=j;
            break;
        }

        {
            i--;
            j++;
        }
    }
    //cout<<ans<<" ";
    int x=(abs(ans-m))*10;
    cout<<x;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[10000];
    int n,m,k,ans=0x3f3f3f3f;
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=m+1;i<=n;i++)
    {
        if(a[i]==0) continue;
        if(a[i]<=k)
        {
            ans=min(ans,(i-m)*10);
            break;
        }
    }
    for(int i=m-1;i>=1;i--)
    {
        if(a[i]==0) continue;
        if(a[i]<=k)
        {
            ans=min(ans,(m-i)*10);
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
	int n, m, k, a, rast, rast1;
	cin >> n;
	cin >> m;
	cin >> k;
	int *arr;
	arr = new int[n];
	if(n == 2)
	{
	    rast = 10;
	}
	else
	{
	    rast = (n - 1) * 10;
	    for (int i = 1; i <= n; i++)
	    {
    		cin >> a;
	    	if (a <= k && a!=0)
	    	{
        		rast1 = (i - m)*10;
	    		if (rast1 < 0)
	    		{
	    			rast1 = (m - i) * 10;
	    		}
	    		if (rast1 < rast)
	    		{
		    		rast = rast1;
	    		}
	    		if(rast == 10)
	    		{
	    		    i = n;
	    		}
	    	}
    	}
	}
	cout << rast;
	return 0;
}

#include <iostream>
#include <math.h>
#include <stdlib.h>

using namespace std;

int main()
{
    int n,m,k;
    int i;
    cin >> n >> m >> k;
    int *Arr = (int *) malloc( n * sizeof(int));
    for(i=0 ; i<n ; i++)
    {
        cin >> Arr[i] ;
    }
    int diff;
    m--;
    int diff2;
    for(i=0 ; i<n ; i++)
    {
        if(Arr[i]!=0 && Arr[i]<=k)
        {
            if(diff)
            {
                if(i>m)
                        diff2 = i-m;
                    else
                        diff2 = m-i ;

                if(diff2 < diff)

                    diff = diff2;
            }
            else
            {
                if(i>m)
                    diff = i-m;
                else
                    diff = m-i;

            }

        }
    }
        cout << diff * 10;

        free(Arr);

        return 0;
    }

#include <bits/stdc++.h>
#define maxn 1007
#define ll long long int
#define _Goodbye_ return 0;
#define space(a,b) cout << a << " " << b << endl;
#define pb push_back
#define is insert
#define _BIGBANG_ int main
#define Friendly ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;
int a[maxn] ;
_BIGBANG_(){
	Friendly
	int n , m , k ;
	cin >> n >> m >> k ;
	for ( int i = 1 ; i <= n ; i++ ){
		cin >> a[i] ;
	}
/*	if ( m == 1 ){
		for ( int i = 2 ; i <= n ; i++ ){
			if ( a[i] <= k && a[i] != 0 ){
				cout << ( i - 1 ) * 10 ;
				return 0 ;
			}
		}
	}
	else if ( m == n ){
		 for ( int i = n - 1 ; i >= 1 ; i-- ){
		 	if ( a[i] <= k && a[i] != 0 ){
		 		cout << ( m - i ) * 10 ;
		 		return 0 ;
			 }
		 }
	}
	else {  */
		int res = 0 , ces = 0 ;
		for ( int i = m - 1 ; i >= 1 ; i-- ){
			if ( a[i] <= k && a[i] != 0  ){
				res = i ;
				break ;
			}
		}
		for ( int i = m + 1 ; i <= n ; i++ ){
			if ( a[i] <= k && a[i] != 0 ){
				ces = i ;
				break ;
			}
		}
		if ( res == 0 ){
			cout << abs ( ces - m ) * 10 ;
		}
		else if ( ces == 0 ){
			cout << abs ( m - res ) * 10 ;
		}
		else{
//			cout << res << " " << ces << endl ;
			cout << min( abs( m - res ) , abs( ces - m ) ) * 10 ;
		}
//	}

	_Goodbye_
}

#include <iostream>
#include <cmath>
using namespace std;
int main(){
	int n,m,w,p,minp=1000000000;
	int a[102];
	cin>>n>>m>>w;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]!=0 && a[i]<=w ){
			p=abs(i-m)*10;
			if(p<minp)
				minp=p;
		}
	}
	cout<<minp;
}

#include <iostream>

#include<algorithm>

#include<math.h>

using namespace std;

int n, m, k, a,i, ans=INT_MAX;

int main()
{
    cin>>n>>m>>k;
    for(i=1;i<=n;i++)
    {
        cin>>a;
        if(a>0 && a<=k)
        {
            if(abs(m-i)<ans)
            {
                ans=abs(i-m);
            }
        }

    }
    cout<<ans*10;

return 0;
}

#include <bits/stdc++.h>
#include<math.h>
#define pi 2.0*acos(0.0)
#define MAX 100005
typedef long long ll;
using namespace std;

int main()
{
    ll a[MAX],i,m,n,k,count1,count2;

    count1=0;
    count2=0;
    cin>>n>>m>>k;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=m;i<=n;i++)
        {
            if(a[i]<=k && a[i]!=0)
                {
                    break;
                }

            if(a[i]>k || a[i]==0)
                {
                    count1=count1+10;
                    if(i==(n))
                        count1=MAX;
                }

        }
    if(m==1)
        {
            cout<<count1;
            return 0;
        }
    for(i=m;i>=1;i--)
        {
            if(a[i]<=k && a[i]!=0)
                    break;
            if(a[i]>k || a[i]==0)
                {
                    count2=count2+10;
                    if(i==1)
                        count2=MAX;
                }

        }
    if(m==n)
        {
            cout<<count2;
            return 0;
        }
    if(count1<count2)
        cout<<count1;
    else if(count1>count2)
        cout<<count2;
    else
        cout<<count1;
    return 0;
}

#include <iostream>
#include <iomanip>
#include <cstdlib>

#include <cmath>
#include <cstring>
#include <cstdio>

int main()
{
	int n,m,k,i,j=1,cost,ans;

	scanf("%d %d %d",&n,&m,&k);
	int ara[n+1];
	memset(ara,0,sizeof(ara));
	for(i=1;i<=n;i++)
	{
		scanf("%d",&ara[i]);
	}
	cost=9999;

	for(i=m+1;i<=n;i++)
	{
		if(ara[i]<=k && ara[i]!=0)
		{
				cost=10*j;
				break;

		}
		j++;
	}
	j=1;
	int store=9999;
	for(i=m-1;i>=1;i--)
	{
		if(ara[i]<=k && ara[i]!=0)
		{
				store=10*j;
				break;
		}
		j++;
	}
	if(store<cost)
	{
		ans=store;
	}
	else
	{
		ans=cost;
	}
	printf("%d\n",ans);

	return 0;
	//main();
}

#include <bits/stdc++.h>

using namespace std;

int n, m, k, ans;

int main() {

    scanf("%d%d%d", &n, &m, &k);
    ans = 10000000;
    for(int x,i = 1; i <= n; i++){
        cin >> x;
        if(x == 0 || x > k) continue;
        ans = min(ans,abs(m-i));
    }

    cout << ans*10 << endl;

return 0;
}

using namespace std;
#include <iostream>
#include <conio.h>

int main()
{
    int n,m,k,minim=100,v=100;
    cin>>n>>m>>k;
    int a[n+1];
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    for(int j=1; j<=n; j++)
    {
        if(a[j]>0)
        {
            if(a[j]<=k)
            {
                if(m-j>0)
                {
                    v=m-j;
                }
                else
                {
                    v=j-m;
                }
                if(v<minim)
                {
                    minim=v;
                }
            }
        }
    }
    minim=minim*10;
    cout<<minim;
    return 0;
}

#include <bits/stdc++.h>

#define ll long long
#define F first
#define S second
#define ever (;;)
#define all(x) x.begin(),x.end()
#define loop(i,o,n) for(int i=o;i<n;i++)
#define loop1(i,o,n) for(int i=o;i<=n;i++)
#define FixTo(x , y) cout.precision(y),cout << fixed << x
#define Life_Is_A_Game_All_You_Have_To_Do_Is_Know_How_To_Play_It ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

using namespace std;

int main()
{
    int n,m,k;
    bool c=0,b=0;
    cin>>n>>m>>k;
    int a[n];
    for(int i=0;i<n;i++)
     cin>>a[i];

    m--;
    int s1=0,s2=0;
    for(int i=m-1;i>=0;i--)
    {
          s1++;
         if(a[i]<=k&&a[i]>0){
          c=1;
          break;
         }

    }
      for(int i=m+1;i<n;i++)
    {     s2++;
         if(a[i]<=k&&a[i]>0){
          b=1;
          break;
         }
    }

    if((c==1 && b==1 && s1<s2)||(c==1 && b==0))
     cout<<s1*10<<"\n";
    else
     cout<<s2*10<<"\n";

}

#include <iostream>

using namespace std;

int main()
{int n, m, k, a, c, b;
 cin >> n >> m >> k;
  b=0;
  c=0;
	for(int i=1;i<=n;i++)
	{cin >> a;
	     if (i<m&&a!=0&&k>=a)
	      b=(m-i)*10;
	     if(i>m&&a!=0&&k>=a)
	      {c=(i-m)*10;
	      break;}
	}
   if ((b>c&&c!=0)||(b==0))
	cout << c;
   else
    cout << b;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

long long x,i,p,j,q,t,k[1000],m,mm,nn,n,y;
double xx,yy;
char l[3000][3000],ll[10000000];
int main()
{
    cin>>x>>p>>q;
    m=0;
    n=0;
    mm=0;
    nn=0;
    for(i=1; i<=x; i++)
        cin>>k[i];
    for(i=p+1; i<=x; i++)
    {
        m=m+10;
        if(k[i]<=q&&k[i]>0)
        {
            mm=1;
            break;
        }
    }
    for(i=p-1; i>0; i--)
    {
        n=n+10;
        if(k[i]<=q&&k[i]>0)
        {
            nn=1;
            break;
        }
    }
    if(mm==0)
        cout<<n<<endl;
    else if(nn==0)
        cout<<m<<endl;
    else
    {
        if(m>=n)
            cout<<n<<endl;
        else
            cout<<m<<endl;
    }

}

// Day 2.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	//reopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// 1 0 1 0 1 0
	// 0 1 1 0 1 0
	// 1 0 0 1 0 1
	int n, m, k;
	cin >> n >> m >> k;
	m--;
	int mn = 1e9;
	for (int i = 0; i < n; i++)
	{
		int temp;
		cin >> temp;
		if (temp == 0)
			continue;
		if (temp > k)
			continue;
		int dist = abs(i - m);
		mn = min(mn, dist);
	}
	cout << mn * 10 << endl;
	// n != 1 * 2 * 3 * 4 * ... * n;
}

// Запуск программы: CTRL+F5 или меню "Отладка" > "Запуск без отладки"
// Отладка программы: F5 или меню "Отладка" > "Запустить отладку"

// Советы по началу работы
//   1. В окне обозревателя решений можно добавлять файлы и управлять ими.
//   2. В окне Team Explorer можно подключиться к системе управления версиями.
//   3. В окне "Выходные данные" можно просматривать выходные данные сборки и другие сообщения.
//   4. В окне "Список ошибок" можно просматривать ошибки.
//   5. Последовательно выберите пункты меню "Проект" > "Добавить новый элемент", чтобы создать файлы кода, или "Проект" > "Добавить существующий элемент", чтобы добавить в проект существующие файлы кода.
//   6. Чтобы снова открыть этот проект позже, выберите пункты меню "Файл" > "Открыть" > "Проект" и выберите SLN-файл.

/*Saidur Rahman Sajol:The Freak*/
  /*Dept. of CSE,IUBAT(162)*/
/*---------------------------*/

#include <bits/stdc++.h>
using namespace std;

#define PI 2*acos(0.0)
#define l long long
#define ll long long
#define ul unsigned long
#define ull unsigned long long

ull minimum(ull a,ull b){
  return (a<b)?a:b;
}
ull maximum(ull a,ull b){
  return (a>b)?a:b;
}
ull great(ull a,ull b){
	if(b==0) return a;
  return great(b,a%b);
}

int main(){
	int n,m,k;
	scanf("%d %d %d",&n,&m,&k);
	int s[n];
	for(int i=0;i<n;i++){
		scanf("%d",&s[i]);
	}
	vector<int>pb;
	vector<int>ps;
	for(int i=0;i<m;i++){
		if(s[i]!=0 && s[i]<=k){
			pb.push_back(i+1);
		}
	}
	for(int i=m;i<n;i++){
		if(s[i]!=0 && s[i]<=k){
			ps.push_back(i+1);
		}
	}
	int seize=pb.size();
	int ana=ps.size();
	if(seize<=0 && ana>0){
		int freak=ps[0];
		int node=abs(freak-m);
		ll weird=10LL*node;
		printf("%lld\n",weird);
	}
	else if(ana<=0 && seize>0){
		int freak=pb[seize-1];
		int node=abs(freak-m);
		ll weird=10LL*node;
		printf("%lld\n",weird);
	}
	else if(ana>0 && seize>0){
		int freak=pb[seize-1];
		int freak1=ps[0];
		int diff1=abs(freak-m);
		int diff2=abs(freak1-m);
//		cout<<diff1<<" "<<diff2<<endl;
		int nude=minimum(diff1,diff2);
	//	int node=abs(nude-m);
		ll weird=10LL*nude;
		printf("%lld\n",weird);
	}
	else puts("0");

	return 0;
}

// by tmt514
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#define SZ(x) ((int)(x).size())
#define FOR(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
using namespace std;
typedef long long LL;

int a[105];
int main(void) {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  m -= 1;
  for(int i=0;i<n;i++) scanf("%d", &a[i]);
  for(int i=1;i<n;i++) {
    if((m-i>=0 && a[m-i] > 0 && a[m-i] <= k) ||
       (m+i<n && a[m+i] > 0 && a[m+i] <= k)) {
      printf("%d\n", i*10);
      return 0;
    }
  }
  return 0;
}

#include <iostream>
#include <stdlib.h>
using namespace std;

int main()
{
    int n=0,m=0,k=0;
    int a[101];
    int dis=100,tem=0;
    cin >> n >> m >> k;
    for(int i=0;i<n;i++){cin >> a[i];}
    m-=1;
    for(int i=0;i<n;i++){
        if(a[i]!=0 && k>= a[i]){
            tem = abs(i-m);
            if(tem<dis){
                    dis=tem;}
        }
    }
    cout << dis*10;
    //cout << "Hello world!" << endl;
    return 0;
}

#include <stdio.h>
#include <iostream>
#include<vector>
using namespace std;

int main()
{
	int  n, m, k, d1 = 9999999999, d2 = 9999999999;
	vector <int> a;
	cin >> n >> m >> k;

	for (int i = 0; i < n; i++)
	{
		int b;
		cin >> b;
		a.push_back(b);
	}

	if (m>1)
	for (int j = 1; m - j - 1 > -1; j++)
	{
		if (a[m - j - 1] != 0 && (a[m - j - 1] < k || a[m - j - 1] == k))
		{
			d1 = 10 * j;
			break;
		}
	}

	if (m<n)
	for (int j = 1; m + j-1 < n; j++)
	{
		if (a[m + j - 1] != 0 && (a[m + j - 1] < k || a[m + j - 1] == k))
		{
			d2 = 10 * j;
			break;
		}

	}

	if (d1>d2)
		cout << d2;
	else
		cout << d1;

	return 0;

}

#include<bits/stdc++.h>
typedef long long ll;
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int32_t main()
{
  IOS;
  int n,m,k;
  int minL,minR;
  cin>>n>>m>>k;
  int a[n+1];
  for(int i=1;i<=n;i++){
    cin>>a[i];
  }
  for(int i=m+1;i<=n;i++){
    if(a[i]<=k and a[i]!=0){
      minL=abs(i-m);
      break;
    }
  }
  for (int i = m-1; i >=0 ; --i)
  {
    if(a[i]<=k and a[i]!=0){
      minR=abs(i-m);
      break;
    }
  }
  (minR>minL)?cout<<(minL*10):cout<<(minR*10);

}

#include<bits/stdc++.h>
using namespace std;
#define NN 200
int a[NN],b[NN];
int main(){
	int n,m,k,t=0,q=0,l=100;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++){
		scanf("%d",a+i);
		if(a[i]>0 && a[i]<=k){
			q=abs(m-i);
			if(q<l) l=q;
		}
	}
	printf("%d",l*10);
	return 0;
}

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>

using namespace std;

#define ll long long

int main() {
	ll i, n, m, k, A[110];
	cin >> n >> m >> k;
	for (i=0;i<n;i++) {
		cin >> A[i];
	}
	ll ans;
	ll lans = 0, lpin = 0;
	for (ll j=m-1;j<n;j++) {
		if (A[j]<=k && A[j]!=0) {
			lpin = 1;
			break;
		}
		else lans++;
	}
	ll rans = 0, rpin = 0;
	for (ll j=m-1;j>=0;j--) {
		if (A[j]<=k && A[j]!=0) {
			rpin = 1;
			break;
		}
		else rans++;
	}
	if (lpin == 0) ans = rans;
	else if (rpin ==0) ans = lans;
	else ans = rans>lans?lans:rans;

	cout << ans*10 << endl;
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main()
{
	int m,n,k;
	cin>>n>>m>>k;
	vector<int>v(n);
	int finalpos,minimo = INT_MAX;
	for(int i = 0;i<n;i++)
	{
		cin>>v[i];
		if(v[i] != 0 && k >= v[i])
		{
			if(abs((i+1)-m) < minimo)
			{
				minimo = abs((i+1)-m);
				finalpos = i;
			}
		}
	}
	cout<<(minimo)*10;

}

//author:satwik_bhv1
#include<bits/stdc++.h>
//datatypes
#define ll long long
#define ld long double
//loops
#define fr(i,z,n) for(ll i=z;i<n;i++)
#define br(i,z,n) for(ll i=z;i>n;i--)
//operations
#define mp  make_pair
#define ff  first
#define ss  second
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
//deque
#define dki deque <ll>
#define dkc deque <char>
//map
#define mi map<ll, ll>
#define mf map<ld, ld>
//vectors
#define vi vector<ll>
#define vc vector<char>
#define vpi vector< pair <ll,ll> >
#define vpc vector<pair <char,char> >
#define vpic vector<pair <ll,char> >
#define vpci vector<pair <char,ll> >
//constants
#define pi 3.1415926535897932384626
#define mod 998244353
/*notes
    pow function should not be used use power function
    range of longlong=(-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 )
    INT_MAX = 2147483647(aprox 2*10^10)
    INT_MIN = -2147483648
    LLONG_MAX = 9223372036854775807
    LLONG_MIN = -9223372036854775808
    MST -> kruskal(DSU)
    sssp -> Dijkstras
    apsp -> Floydwarshall
    __gcd is the function in built for hcf

*/
//start
using namespace std;
//functions
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
bool sortbysec(const pair<ll, ll>& a, const pair<ll, ll>& b) { return (a.second < b.second); }
ll vis[100001],dis[100001];
vi ar[100001];
ll len;
void solve()
{
    ll n,m,k;
    cin>>n>>m>>k;
    vi v(n);
    fr(i,0,n)
    {
        cin>>v[i];
    }
    ll ans=n;
    ll ind=-1;
    fr(i,0,n)
    {
        if(v[i]!=0&&v[i]<=k)
        {
            if(ans>abs(i-(m-1)))
            {
                ans=abs(i-m+1);
                ind=i;
                //cout<<i<<" ";
            }
        }
    }
    cout<<ans*10;
}
int main()
{
    fast();
    ll t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
}

#include <iostream>
#include <math.h>

using namespace std;

int main(int argc, char *argv[])
{
   int n, m, k;
   int a[100];
   int answer = 1000;

   cin >> n >> m >> k;
   for (int i = 0; i < n; ++i)
       cin >> a[i];

   for (int i = 0; i < n; ++i)
       if (a[i] && a[i] <= k)
           if (abs(i-m+1) < answer)
               answer = abs(i-m+1);

   cout << answer * 10;

   return 0;
}

#include <iostream>
using namespace std;

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	int *a = new int[n+1];
	for(int i = 1;i <= n; i++)
		cin >> a[i];
	int c1 = 0, c2 = 0;
	int i = m, j = m;
	bool f1 = true, f2 = true;
	while(i <= n || j > 0){
		if(a[i] <= k && a[i] != 0 && i <= n && f1){
			c1 = (i-m)*10;
		//	cout << a[i] << endl;
			f1 = false;
		}
		if(a[j] <= k && a[j] != 0 && j >0 && f2){
			c2 = (m-j)*10;
		//	cout << a[j] << endl;
			f2 = false;
		}
		i++;
		j--;
		if(!f1 && !f2)
			break;
	}
	if(c1 == 0)
		cout << c2 << endl;
	else if(c2 == 0)
		cout << c1 << endl;
	else if(c1 <= c2 && c1 != 0 && c2 != 0)
		cout << c1 << endl;
	else if(c2 < c1 && c1 != 0 && c2 != 0)
		cout << c2 << endl;
	return 0;
}

#include<iostream>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	int z,house=n+m;
	for (int i = 1; i <= n; i++)
	{
		cin >> z;
		if (z != 0 && z <= k && abs(i  -m) < abs(house  - m))
			house = i;
	}
	cout << abs(house - m) * 10;
	return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
   int n , m , k , min=100 ;
   int arr [101];
   cin >> n >> m >> k ;

   for (int i = 0 ; i< n ; i ++)
   {
       cin >> arr[i];
   }

   for(int i = 1 ; i <= n ; i ++)
   {
       if(arr[i-1]!=0&&arr[i-1]<=k)
       {

           if(min > abs(i-m))
           {
               min = abs(i-m);
           }

       }
   }

   cout << min*10<<endl;
    return 0;
}

#include <iostream>
#include <string>
#include <cstring>
#include <cctype>

using namespace std;

int main() {
	int n, m, k;
	cin >> n >> m >> k;

	int *house_price = new int[n];

	for (int i = 0; i < n; i++) {
		cin >> house_price[i];
	}

	bool*available = new bool[n] {0};
	int *distance_of_house = new int[n];
	int min_distance=n;

	for (int i = 0; i < n; i++) {
		if (house_price[i] != 0) {
			available[i] = true;
		}
	}

	for (int i = 0; i < n; i++) {
		if (available[i]==true && house_price[i]<=k) {
			distance_of_house[i] = abs((m - 1) - i);
		}
	}

	for (int i = 0; i < n; i++) {
		if (distance_of_house[i] > 0) {
			if (distance_of_house[i] < min_distance)
				min_distance = distance_of_house[i];
		}
	}

	cout << min_distance * 10 << endl;

	//system("pause");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int arr[105];
vector<int>s;
int main(void)
{
    int n,m,k;
    scanf("%d %d %d",&n,&m,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&arr[i]);
        if(arr[i]<=k && arr[i]!=0)
            s.push_back(abs(i-m));
    }
    sort(s.begin(),s.end());
    printf("%d\n",s[0]*10);
    return 0;
}

#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n,m,k;
	cin>>n>>m>>k;
	int a;
	m--;
	int mi=10000000;
	for(int i=0;i<n;i++){
		cin>>a;
		if(a<=k&&a){
			mi=min(mi,abs(m-i)*10);
		}
	}
	cout<<mi;
}

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int n,m,k,i;
    int dis[101];
    cin>>n>>m>>k;
    for(i=1;i<=n;i++)
        cin>>dis[i];
    int minn=101;
    for(i=1;i<=n;i++){
        if(dis[i]<=k&&dis[i]){
            if(fabs(i-m)<minn)
                minn=abs(i-m);
        }
    }
    cout<<(minn)*10<<endl;
    return 0;
}

#include<iostream>
using namespace std;
int n,m,k,a[105],dem,dem1,dem2;
main(){
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	for(int i=m-1;i>=0;i--){
		if(a[i]<=k&&a[i]!=0){
			dem1=(m-i)*10;
			break;
		}
	}
	for(int i=m+1;i<=n;i++){
		if(a[i]<=k&&a[i]!=0){
			dem2=(i-m)*10;
			break;
		}
	}
	if(dem1==0) dem=dem2;
	else if(dem2==0) dem=dem1;
	else{
		if(dem1>dem2) dem=dem2;
		else dem=dem1;
	}
	cout<<dem;
}

#include <iostream>

using namespace std;
int N,M,i,j,k,val,maxi,Vect[101],di,dj;

int main()
{
    cin>>N>>M>>k;
    for(i=1;i<=N;i++) cin>>Vect[i];
    i=M-1; j=M+1; di=10000; dj=10000;
    while(i>=1 && (Vect[i]==0 || Vect[i]>k)) i--;
    if(i>=1 && Vect[i]>0 && Vect[i]<=k) di=M-i;
    while(j<=N &&(Vect[j]==0 || Vect[j]>k)) j++;
    if(j<=N && Vect[j]>0 && Vect[j]<=k) dj=j-M;
    cout<<min(di*10,dj*10)<<'\n';
    return 0;
}

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>

using namespace std;

#define then ;
#define cin(n); int n; cin>>n;
#define stop return 0;
//IgorI
//It is true or false
//Is it true or false?

int main()
{
     int n;
     int m;
     int k;

     cin>>n>>m>>k;
     m--;
     int a[1000];
     for(int i=0; i<n; i++)
       cin>>a[i];
     int ans1=99999,ans2=99999;
     for(int i=m+1; i<n; i++)
     {
          if((a[i]<=k)&&(a[i]>0))
          {
               ans1=(i-m)*10;
               break;
          }
     }
     for(int i=m-1; i>=0; i--)
     {
        if((a[i]<=k)&&(a[i]>0))
          {
               ans2=(m-i)*10;
               break;
          }
     }
     //cout<<ans1<<" "<<ans2<<" ";
     cout<<min(ans1,ans2);

}

#include<bits/stdc++.h>
using namespace std;
int val[101],id,mon,n;
bool b[101];
int main()
{
    cin>>n>>id>>mon;
    for(int i=1;i<=n;i++)
    {
        cin>>val[i];
        if(!val[i])
        {
            b[i]=1;
        }
    }
    int l=id,r=id;
    while(1)
    {
        if(l<=0)
        {
            l=1;
        }
        if(r>n)
        {
            r=n;
        }
        if(b[l]||val[l]>mon)
        {
            l--;
        }
        else
        {
            cout<<(id-l)*10<<endl;
            return 0;
        }
        if(b[r]||val[r]>mon)
        {
            r++;
        }
        else
        {
            cout<<(r-id)*10;
            return 0;
        }
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int p[100001];

int main()
{
	int n,m,k;
	cin>>n>>m>>k;
	int min=999;
	p[m]=0;
	for(int i=1;i<=n;++i)
	{
		cin>>p[i];
	}
	int dis=0;
	for(int i=1;i<=n;++i)
	{
		if(p[i]!=0&&p[i]<=k)
		{
			dis=abs(i-m)*10;
			if(dis<min)
			{
				min=dis;
			}
		}
	}
	cout<<min;
}

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int arr[1000];
int main() {

	int n, m, k, distanceMinLeft = INT_MAX, distanceMinRight = 0, tempDistance = 0;
	cin >> n >> m >> k;

	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		arr[i] = a;
	}

	for (int i = 0; i < m; i++)
	{
		if (arr[i] == 0)
			continue;
		if (k >= arr[i]) {
			for (int j = i; j < m-1; j++)
			{
				tempDistance += 10;
			}
			if (tempDistance < distanceMinLeft) {
				distanceMinLeft = tempDistance;
			}
		}
		tempDistance = 0;
	}
	for (int i = m; i < n; i++)
	{
		if (arr[i] == 0)
			continue;
		if (k >= arr[i]) {
			for (int j = m; j <= i; j++)
			{
				distanceMinRight += 10;
			}
			break;
		}
	}
	if (distanceMinLeft != 0 && distanceMinRight != 0) {
		cout << min(distanceMinLeft, distanceMinRight) << endl;
	}
	else if (distanceMinLeft != 0 && distanceMinRight == 0) {
		cout << distanceMinLeft << endl;
	}
	else {
		cout << distanceMinRight << endl;
	}

	//system("pause");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{

	long n,i,m,k,lead=INT_MAX,cnt=0;
	cin>>n>>m>>k;
	m--;
	long a[n];
	for(i=0;i<n;i++)
	    cin>>a[i];
	for(i=m;i<n;i++)
	    {
	        //cout<<a[i]<<" ";
	        if(a[i]<=k && a[i]!=0)
	        {
	            cnt=a[i];
	            //cout<<cnt<<endl;
	            lead=(i-m);
	            break;
	        }
	    }
	    for(i=m-1;i>=0;i--)
	    {
	        //cout<<a[i]<<" ";
	        if(a[i]<=k && (m-i)<lead && a[i]!=0)
	        {
	            cnt=a[i];
	            //cout<<cnt<<endl;
	            lead=m-i;
	            break;
	        }
	    }
	    cout<<lead*10;
}

#include<bits/stdc++.h>
using namespace std;
int leftans=9999999,rightans=9999999,n,a,m,q;
int main()
{
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a);
		if(i<m&&a<=q&&a)leftans=(m-i)*10;
		if(i>m&&a<=q&&a){rightans=(i-m)*10;break;}
	}
	printf("%d\n",min(leftans,rightans));
	return 0;
}

#include <iostream>
#include <stdlib.h>

using namespace std;

void main() {
	int n, m, k, rast, minR;
	cin >> n >> m >> k;
	int *a = new int [n+1];
	minR = 10 * n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		if (i < m && k >= a[i] && a[i] != 0)
		{
			rast = 10 * (m - i);
			if (rast < minR) minR = rast;
		}
		else if (i > m && k >= a[i] && a[i] != 0)
		{
			rast =  10 * (i - m);
			if (rast < minR) minR = rast;
		}
	}
	cout << minR;
	cin >> n;
}

#include<iostream>
#include<string>
using namespace std;

int main()
{
	int houses_number, girlfriends_house, zeins_amount, house_price;
	cin >> houses_number >> girlfriends_house >> zeins_amount;
	double * prices_arr = new double[houses_number];
	int min_distance = 1000000;
	int suitable_price_index;
	int * indexes_arr = new int[houses_number];
	int indexes_arr_countrer = 0;
	int girlfriends_house_index = girlfriends_house - 1;

	for (int i = 0; i < houses_number; i++)
	{
		cin >> house_price;
		prices_arr[i] = house_price;
	}

	suitable_price_index = 1000000;
	int suitable_house_index = 0;

	for (int i = 0; i < houses_number; i++)
	{
		if (prices_arr[i] <= zeins_amount && prices_arr[i] > 0)
		{
			suitable_price_index = prices_arr[i];
			indexes_arr[indexes_arr_countrer] = i;
			indexes_arr_countrer++;
		}
	}

	for (int i = 0; i < indexes_arr_countrer; i++)
	{
		suitable_house_index = girlfriends_house_index - indexes_arr[i];
		if (abs(suitable_house_index) < min_distance)
		{
			min_distance = abs(suitable_house_index);
		}
	}

	cout << min_distance * 10 << endl;

	return 0;
}

#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	int n,m,k,a[1000],mina=0,minb=0;
	cin >> n>>m>>k;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	int flaga = 0, flagb = 0;

	for (int i = m+1; i <= n; i++)
	{
		mina += 10;
		if (a[i] <= k && a[i]!=0)
		{
			flaga = 1;
			break;
		}
	}

	for (int i = m-1; i > 0; i--)
	{
		minb += 10;
		if (a[i] <= k && a[i] != 0)
		{
			flagb = 1;
			break;
		}

	}
	if (flaga == 0)
	{
		mina = 0;
	}

	if (flagb == 0)
	{
		minb = 0;
	}
	//cout << mina << endl;
	//cout << minb <<endl;

	if (mina > 0 && minb == 0) { cout << mina; goto end; }
	if (minb > 0 && mina == 0) { cout << minb; goto end; }
	mina >= minb ? cout << minb : cout << mina;
	end:
	//system("pause");
	return 0;
}

#include<iostream>
using namespace std;
int n, m, k, a[101], ans;
main ()
{
     cin>>n>>m>>k;
     for (int i=1; i<=n; i++)
     cin>>a[i];
     for (int i=m-1; i>=1; i--)
     if (a[i]<=k && a[i]!=0) {ans=m-i; break;}
     for (int i=m+1; i<=n; i++)
     if (a[i]<=k && a[i]!=0) {if (ans>i-m || ans==0) ans=i-m; break;}
     cout<<ans*10<<endl;
     //system ("pause");
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <algorithm>
#include <map>
#include <queue>
#include <clocale>
#include <bitset>
#include <memory.h>

using namespace std;

#pragma comment (linker, "/STACK:667177216")
#define ll long long
#define LL long long
#define ull unsigned long long
#define sc(a) scanf("%d",&a)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mp make_pair
#define pb push_back
const ll mod = 1000000009;
#define INF (int)(2e9 + 1e8)
#define LINF (ll)(4e18)
#define forn(i,n) for(int (i) = 0;(i)<n;i++)
#define forit(mas) for(auto(it)=(mas).begin();(it)!=(mas).end();(it)++)

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, m, k;
	cin >> n >> m >> k;
	vector<pair<int, int>>mas;
	for (int i = 1; i <= n; i++) {
		int a;
		cin >> a;
		if (a != 0) mas.pb(mp(abs(m - i)* 10,a));
	}
	sort(all(mas));
	for (int i = 0; i < mas.size(); i++) {
		if (mas[i].second <= k) {
			cout << mas[i].first << endl;
			return 0;
		}
	}
	return 0;
}

#include <iostream>
#define FOR(i,j,k); for(int i = j; i < k; ++i)
using namespace std;
long long int houses[10000];

void initialize(){
	FOR(i, 0, 10000){
		houses[i] = 0;
	}
}

int main(){
	int n, m, k;
	initialize();
	cin >> n >> m >> k;
	FOR(i, 1, n+1){
		cin >> houses[i];
	}
	int distancia = 0;
	int l = 0, r = 0;
	l = m - 1;
	r = m + 1;
	while (l >= 1 || r <= n){
		distancia += 10;
		if ((houses[l] != 0 && houses[l] <= k) || (houses[r] != 0 && houses[r] <= k)){
			cout << distancia << endl;
			break;
		}
		else{
			l -= 1;
			r += 1;
		}
	}
	return 0;
}

#include<iostream>
using namespace std ;
int main ()
{

int x,y,z,a,small(10000);
cin>>x>>y>>z;
int *arr1 = new int [x];
for (int i=0 ;i<x;i++)
cin>>arr1[i];
// check for 0
int v(0),c(0);
for (int i=0;i<x;i++)
{
if(c==arr1[i])
	v++;
}
if(v==x)
	cout<<'0'<<endl;
else {
	for(int i=0;i<x;i++)
	{
		int d(0);
if (z>=arr1[i]&&arr1[i]!=0)
{
	a=i+1;
	if (y>a)
d=y-a;
	else
		d=a-y;
	if (small>d)
		small =d;
}

	}
	cout<<small*10<<endl;

     }

	return 0 ;
}

#include <bits/stdc++.h>
using namespace std;

signed main() {

	int n, m, k;
	cin >> n >> m >> k;

	int a[n + 1];
	for(int i = 1; i <= n; i++)
		cin >> a[i];

	int l = m - 1, r = m + 1;

	bool left = 0;

	while(l >= 1 or r <= n)
	{
		if(l >= 1 and a[l] <= k and  a[l] != 0)
		{
			left = 1;
			break;
		}

		if(r <= n and a[r] <= k  and a[r] != 0)
		{
			break;
		}

		l--;
		r++;
	}

	if(left)
		cout << (m - l) * 10;
	else
		cout << (r - m) * 10;

	return 0;
}

#include<iostream>//CF796A
#include<cstdio>
#include<cstring>
#include<string>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<vector>
#include<set>
using namespace std;
int a[200];
int main()
{
	int n,m,i,k,j,l,p;
	cin>>n>>m>>k;a[0]=a[n+1]=1000;l=p=0;
	for(i=1;i<=n;i++)cin>>a[i];
	for(i=m,j=m;i!=0||j!=n+1;)
	 {
	 	if(i>=1){i--;if(a[i]!=0&&a[i]<=k&&a[i]!=1000)l=i;}
	 	if(j<=n){j++;if(a[j]!=0&&a[j]<=k&&a[j]!=1000)p=j;}
	 	if(l!=0||p!=0)
	 	 if(a[l]<=a[p]){cout<<(m-l)*10<<endl;return 0;}
	 	 else{cout<<(p-m)*10<<endl;return 0;}
	 }
	 return 0;
}

#include <iostream>

using namespace std;

#define MAXN 101

int n, m, k;
int cost[MAXN];

int main(){
	//freopen("input.txt", "rt", stdin);
	cin >> n >> m >> k;
	m--;
	for(int i = 0; i < n; i++){
		cin >> cost[i];
	}
	int Min = 1000000000;
	for(int i = m-1; i >= 0; i--){
		if(cost[i] != 0 && cost[i] <= k){
			Min = 10*(m-i);
			break;
		}
	}
	for(int i = m+1; i < n; i++){
		if(cost[i] != 0 && cost[i] <= k){
			if(Min > 10*(i-m)){
				Min = 10*(i-m);
			}
			break;
		}
	}

	cout << Min << endl;

	return 0;
}

#include<bits/stdc++.h>

using namespace std;

int n;
const int maxn=100;
int k,a[maxn],m;

void solve(){
    int res=-1;
    for(int i=1;i<=n-m;i++){
            if(a[m+i-1]!=0 && a[m+i-1]<=k){
                res=i;
                break;
            }
    }
    for(int i=1;i<m;i++){
        if(a[m-1-i]!=0 && a[m-1-i]<=k){
            if(res==-1 || i<res){
                res=i;
            }
            break;
        }
    }
    cout<<res*10;
}

int main(){
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)cin>>a[i];
    solve();
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> A(n);
    for (auto &a : A)
        cin >> a;

    int ans = 105;
    // ignore houses
    for (int i = 0; i < n; i++)
        if (A[i] > k)
            A[i] = 0;
    // houses to the right
    for (int d = 0, i = m - 1; i < n; i++, d++) {
        if (A[i] > 0) {
            ans = d;
            break;
        }
    }
    // houses to the left
    for (int d = 0, i = m - 1; i >= 0; i--, d++) {
        if (A[i] > 0) {
            ans = min(ans, d);
            break;
        }
    }
    cout << ans * 10;

    return 0;
}

#include <iostream>
#include <cmath>

using namespace std;

int main(){
	int q, n, m, k, t, s;
	s = 100;
	cin >> n >> m >> k;
	for (int i = 0; i < n; ++i) {
		cin >> q;
		if (q && q <= k) {
			t = abs(i - m + 1);
			if (t < s) {
				s = t;
			}
		}
	}
	cout << s * 10;
	return 0;
}

#include <iostream>
#include <string.h>
#include <set>
#include <vector>
#include <queue>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <stack>
#include <iomanip>
#include <functional>
#include <limits.h>
using namespace std;
#define ll long long int
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,n) for(ll i=1;i<n;i++)
#define N 100000
//done?????
int main()
{
    ll n,m,k,c=INT_MAX;
    cin>>n>>m>>k;
    ll a[n+1];
    rep2(i, n+1)
    {
        cin>>a[i];
        if(a[i]!=0&&a[i]<=k)
        {
            c=min(c,abs(i-m));
        }
    }
    cout<<10*c;

}

#include<bits/stdc++.h>
using namespace std;
int min1=100,n,m,qian,a[101];
int main()
{
	scanf("%d%d%d",&m,&n,&qian);
	for (int i=1;i<=m;i++)
	  scanf("%d",&a[i]);
	for (int i=n-1;i>=1;i--)
	  if (a[i]!=0&&a[i]<=qian)
	  {
	  	min1=n-i;
	  	break;
	  }
	for (int i=n+1;i<=m;i++)
	  if (a[i]!=0&&a[i]<=qian)
	  {
	  	min1=min(min1,i-n);
	  	break;
	  }
	printf("%d",min1*10);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    long long x,y,z;
    cin>>x>>y>>z;
    long long a[x],b=0,c=0;
    for(int i=0;i<x;i++){
        cin>>a[i];
    }
    bool f=1;
    for(int i=y-1;i<x;i++){
        if(a[i]==0){b+=10;continue;}
        else if(z>=a[i]){f=0;break;}
        else{b+=10;}
    }
    bool d=1;
    for(int i=y-1;i>=0;i--){
        if(a[i]==0){c+=10;continue;}
        else if(z>=a[i]){d=0;break;}
        else{c+=10;}
    }
    if(!d&&!f){cout<<min(c,b)<<endl;return 0;}
    else if(!d&&f){cout<<c<<endl;}
    else{cout<<b<<endl;}
    return 0;
}

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n, m, d;
    vector<int> prices;
    cin >> n >> m >> d;
    int p;
    for(int i = 0; i < n; i++){cin >> p; prices.push_back(p);}
    int l = 100001;
    for(int i = 0; i < n; i++)
    {
        if(prices[i] != 0 && prices[i] <= d)
        {
            l = min(l, abs((i + 1) - m));
        }
    }
    cout << (l) * 10;
    return 0;
}

#include <stdio.h>
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	long long n,m,k,num,dis,max;
	//freopen("list.txt","r",stdin);
	cin>>n>>m>>k;
	dis=n;
	max=k;
	for (long long i=0;i<n;i++)
	{
		cin>>num;
		if (num!=0 && num<=max && abs(i+1-m)<dis)
			dis=abs(i+1-m);
	}

	cout<<dis*10<<"\n";
}

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define reg register
#define in cin>>
#define out cout<<
#define end return 0
#define ios ios_base::sync_with_stdio(false)
using namespace std;
int main(){
    ios;
    reg int n,m,k,ans=2147483647;
    in n>>m>>k;
    int a[n];
    for(reg int i=0;i<n;i++){
    	in a[i];
    	if(k<a[i])a[i]=0;
    	if(a[i]!=0){
			a[i]=10*abs(i+1-m);
			if(a[i]<ans)ans=a[i];
		}
    }
    out ans;
    end;
}

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int n , m , k , arr[110] , md=10000;

    cin>>n>>m>>k;

    for(int i = 0 ; i < n ; i++)
    {
        cin>>arr[i];

    }

    for(int i =0 ; i <n ; i++)
    {
        if(arr[i]<=k && arr[i]!=0)
            {if( abs(i-(m-1))*10 < md)
              md=abs(i-(m-1))*10;
            }
    }

    cout<<md<<endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define NN 200
int a[NN],b[NN];
int main(){
	int n,m,k,t=0,q=0,l=100;
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;i++){
		scanf("%d",a+i);
		if(a[i]>0 && a[i]<=k){
			q=abs(m-i);
			if(q<l) l=q;
		}
	}
	printf("%d",l*10);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back

int main()
{
    ll i, n, m, k, a;
    vector < ll > v, v2;
    cin >> n >> m >> k;
    m--;
    for(i = 0; i < n; i++)
    {
        cin >> a;
        v.pb(a);
    }
    ll ans = 0, mn = 0, check = 0;
    for(i = m - 1; i >= 0; i--){
        if(v[i] <= k && v[i] != 0){
            mn += 10;
            check = 1;
            break;
        }
        else
            mn += 10;
    }
    if(check == 1)
        ans = mn;
    check = 0;
    mn = 0;
    //cout << m + 1 << endl;
    for(i = m + 1; i < n; i++){
        if(v[i] <= k && v[i] != 0){
            mn += 10;
            check = 1;
            break;
        }
        else
            mn += 10;
    }
    if(check == 0)
        mn = 0;
    //cout << ans << " " << mn << endl;
    if(ans != 0 && mn != 0)
        cout << min(ans, mn) << endl;
    else
        cout << max(ans, mn) << endl;

    return 0;
}

#include<iostream>
using namespace std;
int main(){

	int n,h,am,sum1=0,sum2=0;
	int array[103];
	cin>>n>>h>>am;
	for (int i = 0 ; i < n ;i++){
		cin>>array[i];
	}
	int flag1 = 1;
	for (int i = h-1 ;i < n ; i++){
		if (array[i]<=am && array[i]!=0){
			flag1 = 0;
			break;
		}
		else {

		sum1+= 10;
	}
	}
	int flag2 = 1;
	for (int i = h-1 ;i >= 0  ;i -- ){
		if (array[i]<=am && array[i]!=0){
			flag2 = 0;
			break;

		}
		else {
		sum2+=10;
	}
	}
   if (sum1<=sum2){
   	if (flag1==0)cout<<sum1<<"\n";
   	else cout<<sum2;
   }
   else  if (sum2<sum1){
   	if (flag2==0)cout<<sum2<<"\n";
   	else cout<<sum1;
   }

}

#include <iostream>

using namespace std;

int main()
{
	int n, m, k, a, rast, rast1;
	cin >> n;
	cin >> m;
	cin >> k;
	int *arr;
	arr = new int[n];
	if(n == 2)
	{
	    rast = 10;
	}
	else
	{
	    rast = (n - 1) * 10;
	    for (int i = 1; i <= n; i++)
	    {
    		cin >> a;
	    	if (a <= k && a!=0)
	    	{
        		rast1 = (i - m)*10;
	    		if (rast1 < 0)
	    		{
	    			rast1 = (m - i) * 10;
	    		}
	    		if (rast1 < rast)
	    		{
		    		rast = rast1;
	    		}
	    		if(rast == 10)
	    		{
	    		    i = n;
	    		}
	    	}
    	}
	}
	cout << rast;
	return 0;
}

#include<iostream>
#include<string>
#include<cmath>
#include<cctype>
#include<vector>
#include<sstream>
using namespace std;
int main(){
	int n,m,k;
	cin>>n>>m>>k;
	int a[100];
	int x;
	for(int i=0;i<n;i++){
		cin>>x;
		a[i]=x;
	}
	int t=1;
	for(int i=0;;i++){
		if(m-1+t<=n-1){

		if(a[m-1+t]!=0&&a[m-1+t]<=k){
			cout<<t*10;
			break;
		}
	}
		if(t<=m-1){

		if(a[m-1-t]!=0&&a[m-1-t]<=k){
			cout<<t*10;
			break;
		}
	}
		t++;
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    m--;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];

    int res = 10000000;
    for (int i = n - 1; i > m; i--)
        if (a[i] != 0 && a[i] <= k)
            res = (i - m) * 10;

    for (int i = 0; i < m; i++)
        if (a[i] != 0 && a[i] <= k && res > (m - i) * 10)
            res = (m - i) * 10;

    cout << res;
    return 0;
}

#include <iostream>
using namespace std;
int main(){
	int n,m,p,*a;
	cin>>n>>m>>p;
	m--;
	a=new int [n];
	for(int i=0; i<n; i++) cin>>a[i];
	for(int i=1;;i++){
		if(m+i<n && a[m+i]!=0 && a[m+i]<=p ||m-i>=0 && a[m-i]!=0 && a[m-i]<=p){
			cout<<i*10;
			break;
		}
	}
}

#include<bits/stdc++.h>
#define ll int long long
using namespace std;
int main()
{
   int n,m,k,l=-1,r=-1;
   cin>>n>>m>>k;
   int a[n+1];
   for(int i=1;i<=n;i++)cin>>a[i];
   for(int i=m-1;i>0;i--){
      if(k>=a[i]&&a[i]!=0){l=i;break;}
   }
   for(int i=m+1;i<=n;i++){
      if(k>=a[i]&&a[i]!=0){r=i;break;}
   }
   if(l==-1||r==-1){cout<<10*abs(m-max(l,r));return 0;}
   cout<<10*min(abs(m-l),abs(m-r));
}

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[105] = { 0 }, M, N, K;
	cin >> N >> M >> K;
	for (int i = 1; i <= N; i++)
	{
		cin >> a[i];
	}
	int i = M, j = M;
	while (i >= 1)
	{
		if (K >= a[i] && a[i])
		{
			break;
		}
		i--;
	}
	while (j <= N)
	{
		if (K >= a[j] && a[j])
		{
			break;
		}
		j++;
	}
	int k = min(j - M, M - i);
	if (i==0)
	{
		k = j - M;
	}
	if (j == N + 1)
	{
		k = M - i;
	}
	cout << k * 10 << endl;
	return 0;
}

#include <iostream>
#include <math.h>
#include <stdlib.h>

using namespace std;

int main()
{
    int n,m,k;
    int i;
    cin >> n >> m >> k;
    int *Arr = (int *) malloc( n * sizeof(int));
    for(i=0 ; i<n ; i++)
    {
        cin >> Arr[i] ;
    }
    int diff;
    m--;
    int diff2;
    for(i=0 ; i<n ; i++)
    {
        if(Arr[i]!=0 && Arr[i]<=k)
        {
            if(diff)
            {
                if(i>m)
                        diff2 = i-m;
                    else
                        diff2 = m-i ;

                if(diff2 < diff)

                    diff = diff2;
            }
            else
            {
                if(i>m)
                    diff = i-m;
                else
                    diff = m-i;

            }

        }
    }
        cout << diff * 10;

        free(Arr);

        return 0;
    }

/*Simanta Deb Turja's Template*/

#include <bits/stdc++.h>

//MACROS
#define repB(i, a, b) for(i = b; i < a; i++)
#define rep0(i, a) for(i = 0; i < a; i++)
#define reprev(i, a, b) for(i = b; i >= a; i--)
#define tcLoop(i, a) for(i = 1; i <= a; i++)

//Constant Values
#define MAX 1000007

typedef unsigned long long ull;
typedef long long ll;

using namespace std;

int main()
{
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "a", stdout);
  ios_base :: sync_with_stdio(false);
  //cin.tie(NULL);
  int n, m, k;
  while(cin >> n >> m >> k) {
    int arr[101];
    int maximumP = 10;
    int maximumN = 10;
    int maximumA = 10;
    int mark1;
    int mark2;
    int mark3;

    for(int i = 1; i <= n; i++) {
      cin >> arr[i];
    }

    if(m == 1) {
      for(int i = m + 1; i <= n; i++) {
        if(arr[i] <= k && arr[i] != 0) {
          mark1 = i;
          break;
        }
      }
      cout << maximumA * (mark1 - 1) << endl;
    }
    else if(m == n) {
      for(int i = m - 1; i >= 1; i--) {
        if(arr[i] <= k && arr[i] != 0) {
          mark1 = i;
          break;
        }
      }
      cout << maximumA * (n - mark1) << endl;
    }
    else if(m > 1 && m != 1 && m!=n) {
      for(int i = m - 1; i >= 1; i--) {
        if(arr[i] <= k && arr[i] != 0) {
          mark2 = i;
          break;
        }
      }
      for(int i = m + 1; i <= n; i++) {
        if(arr[i] <= k && arr[i] != 0) {
          mark3 = i;
          break;
        }
      }
      maximumN = maximumN * (m - mark2);
      maximumP = maximumP * (mark3 - m);
      //cout << "P: " << maximumP << endl;
      //cout << "N: " <<maximumN << endl;
      int ans = min(maximumP, maximumN);
      cout << ans << endl;
    }

  }

  return 0;
}

#include <bits/stdc++.h>
#include<math.h>
#define pi 2.0*acos(0.0)
#define MAX 100005
typedef long long ll;
using namespace std;

int main()
{
    int a[MAX],i,m,n,k,count1,count2;
    count1=0;
    count2=0;
    cin>>n>>m>>k;
    for(i=1;i<=n;i++)
        cin>>a[i];
    for(i=m;i<=n;i++)
        {
            if(a[i]<=k && a[i]!=0)
                {
                    break;
                }

            if(a[i]>k || a[i]==0)
                {
                    count1=count1+10;
                    if(i==0 && a[i]==0)
                        count1=0;

                }

        }
    if(m==1)
        {
            cout<<count1;
            return 0;
        }
    for(i=m;i>=1;i--)
        {
            if(a[i]<=k && a[i]!=0)
                    break;
            if(a[i]>k || a[i]==0)
                {
                    count2=count2+10;
                    if(i==(n-1) && a[i]==0)
                        count2=0;
                }

        }
    if(m==n)
        {
            cout<<count2;
            return 0;
        }
    if(count1<count2)
        cout<<count1;
    else if(count1>count2)
        cout<<count2;
    else
        cout<<count1;
    return 0;
}

#include <iostream>
#include <fstream>
#include <stdlib.h>

using namespace std;

int main()
{
	ifstream fin("input.txt");
	ofstream fout("output.txt");
	char buff[5];
	int n, m, k, a, rast, rast1;
	bool flag = true;
	fin >> buff;
	n = atoi(buff);
	fin >> buff;
	m = atoi(buff);
	fin >> buff;
	k = atoi(buff);
	int *arr;
	arr = new int[n];
	rast = (n - 1) * 10;
	for (int i = 1; i <= n; i++)
	{
		fin >> buff;
		a = atoi(buff);
		arr[i] = a;
		if (arr[i] <= k && arr[i]!=0)
		{
			rast1 = (i - m)*10;
			if (rast1 < 0)
			{
				rast1 = rast1 * (-1);
			}
			if (rast1 < rast)
			{
				rast = rast1;
			}
		}
	}
	fout << rast;
	return 0;
}

#include <bits/stdc++.h>
#include<iostream>
#include <iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<sstream>

using namespace std;

#define T(a)            cerr << #a << ": " << a << endl;
#define TT(a,b)         cerr << #a << ": " << a << " | " << #b << ": " << b << endl;
#define TTT(a,b,c)      cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << endl;
#define TTTT(a,b,c,d)   cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;

///**** Max/Min********///

#define _max(aa, bb) (aa = max(aa, bb))
#define max2(aa, bb) max(aa, bb)
#define max3(aa, bb, cc) max(aa, max(bb, cc))
#define max4(aa, bb, cc, fk) max(max(aa, fk), max(bb, cc))
#define _min(aa, bb) (aa = min(aa, bb))
#define min2(aa, bb) min(aa, bb)
#define min3(aa, bb, cc) min(aa, min(bb, cc))
#define min4(aa, bb, cc, dd) min(min(aa, dd), min(bb, cc))

#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define open  freopen("input.txt","r",stdin)
#define close  freopen ("output.txt","w",stdout)

#define mem(n) memset(n,0,sizeof(n))
#define LCM(a,b) (a / __gcd(a,b) ) * b
#define gcd(a,b) __gcd(a,b)
#define for0(l,n) for(int l=0;l<n;l++)
#define for1(l,n) for(int l=1;l<=n;l++)

#define db double
#define ll long long
#define lll unsigned long long
#define loop(i,a,n) for(int i=a;i<=n;i++)
#define sz size()
#define sf scanf
#define sf1(a) sf("%d",&a)
#define sf2(a,b) sf("%d %d",&a,&b)
#define sf3(a,b,c) sf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) sf("%d %d %d %d",&a,&b,&c,&d)
#define sfd(a) sf("%lf",&a)
#define sfd2(a,b) sf("%lf %lf",&a,&b)
#define sfd3(a,b,c) sf("%lf %lf %lf",&a,&b,&c)
#define sfl1(a) sf("%lld",&a)
#define sfl2(a,b) sf("%lld %lld",&a,&b)
#define sfl3(a,b,c) sf("%lld %lld %lld",&a,&b,&c)

#define pii pair<int,int>
#define pll pair<ll,ll>

#define pf printf
#define pfi(x) pf("%d",x)
#define pfl(x) pf("%lld",x)
#define pf1(x) pf("%d\n",x)
#define pf2(x,y) pf("%d %d\n",x,y)
#define pf3(x,y,z) pf("%d %d %d\n",x,y,z)
#define pfl1(x) pf("%lld\n",x)
#define pfl2(x,y) pf("%lld %lld\n",x,y)
#define pfl3(x,y,z) pf("%lld %lld %lld\n",x,y,z)

#define sps(a,n)  cout << setw(a) << n << " in binary is" << setw(a);
//"   5 in binary is  101"//

#define stdf  std::cout << std::fixed;
#define stc1(c,f)    std::cout << std::setprecision(c) << f << '\n';

/**********
int main () {
    int c;
   double f =3.14159;
   stc1(5,f);
   stc1(9,f);//all number count//
   stdf;
   stc1(8,f);//.before count number//
   stc1(10,f);
   return 0;
}
************/

#define pfd(x,k) cout<<fixed<<setprecision(k)<<x;
/*******
int main () {
    int c;
   double f =3.14159;
   pfd(10,f);
   return 0;
}
********/

int main()
{
    int i,n,m,x,f,f1,f2;
    sf3(n,m,x);
    m-=1;
    vector<int>vc(n);
    vector<int>::iterator it;
    for(i=0; i<vc.size(); i++)
    {
        sf1(vc[i]);
    }
    for(i=m+1; i<vc.size(); i++)
    {
        if(vc[i]<=x && vc[i]!=0)
        {
            f=i;
            break;
        }
    }
    for(i=0; i<=m; i++)
    {
        if(vc[i]<=x && vc[i]!=0)
        {
            f2=i;
        }
    }
    if(m==0)
        pf1((f-m)*10);
    else if(m==n-1)
        pf1((m-f2)*10);
    else
    {
        int ans=(m-f2)*10;
        int ans2=(f-m)*10;
        pf1(min(ans,ans2));
    }

    return 0;
}

//----------------------Created by Anik Saha---------------------------//
#include <bits/stdc++.h>
using namespace std;

#define FastIO ios_base::sync_with_stdio(false);    cin.tie(NULL);
#define testCase int test{0};   cin>>test;  while(test--)
#define forLoop(x, y, z) for(int (x) = (y); (x) < (z); (x)++)
#define take_n int n{0};   cin>>n;
#define swap(a,b,ty) ty temp{a};    (a) = (b);    (b) = (temp);
typedef unsigned char Byte;
typedef long long ll;
typedef unsigned long long ull;

template<typename T>
void input_array(T arr[], int &n){
    for(int i = 0; i < n; i++){
        cin>>arr[i];
    }
}
//---------------------------Goob luck---------------------------------//

int main(){
    FastIO

    int n{0},m{0},k{0},forword{INT_MAX},back{INT_MAX};
    cin>>n>>m>>k;
    int arr[n];
    input_array<int>(arr,n);

    forLoop(i,m,n){
        if(arr[i] != 0 && arr[i] <= k){
            forword = (i - (m-1))*10;
            break;
        }
    }

    for(int i = m-2; i > 0; i--){
        if(arr[i] != 0 && arr[i] <= k){
            back = ((m-1) - i)*10;
            break;
        }
    }

    cout<<std::min(forword,back)<<'\n';

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m, k, a;
    cin >> n >> m >> k;
    vector<int> list(n);

    for (int i = 0; i < n; ++i) {
        cin >> a;
        list[i] = a;

    }
    int min = 0;
    for (int j = 0; j < n; ++j) {
        if (list[j] < k && list[j] > 0){
            //min = abs(m- (j+1));
            min = (j+1) - m;
        }

    }

    cout << min*10;
}

#include<iostream>
using namespace std;
int m,n,k,ans=0;
main(){
cin>>n>>m>>k;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
int f=a[0];
for(int i=0;i<n;i++)
if(a[i]<f && a[i]>0)
{if(ans<0)
ans=i-m;
f=a[i];
}
cout<<ans*10;

}

#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, m, k, arr[100];
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    m--;
    int mn = 2147483647;
    for (int i = m; i >= 0; i--)
        if (arr[i] > 0)
        {
            mn = min(mn, arr[i]);
            break;
        }
    for (int i = m; i < n; i++)
        if (arr[i] > 0)
        {
            mn = min(mn, arr[i]);
            break;
        }
    cout << mn << '\n';
    return 0;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//#define int                 long long
#define ll                  long long
#define ld                  long double
#define rep(i,n)            for(int i=0;i<n;i++)
#define hell                1000000007LL
#define inf                 (ll)1e15
#define vi                  vector<int>
#define vii                 vector< vi >
#define pb                  push_back
#define mp                  make_pair
#define fi                  first
#define se                  second
#define pii                 pair<int,int>
#define all(c)              c.begin(),c.end()
#define sz(c)               (int)c.size()
#define hash1               105727LL
#define hash2               hell
#define eps                 1e-10
#define pi                  3.141592653589793238462643383279502884197
typedef tree<pair<int,int>,null_type,less<pair<int,int> >,
				rb_tree_tag,tree_order_statistics_node_update> statisticsTree;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
ll power(ll x, ll y,ll p)
{
	ll res=1;
	x=x%p;
	while(y>0)
	{
		if(y&1)
			res=((res%p)*(x%p))%p;
		y=y>>1;
		x=((x%p)*(x%p))%p;
	}
	return res;
}
ll raichu(ll x,ll y)
{
	ll res=1;
	while(y>0)
	{
		if(y&1)
			res=((res)*(x));
		y=y>>1;
		x=((x)*(x));
	}
	return res;
}
bool isprime(ll n)
{
	if(n<2) return false;
	else if(n==2) return true;
	else if(n%2==0) return false;
	else
	{
		ll z=sqrt(n);
		rep(i,z-1) if(n%(i+2)==0) return false;
		return true;
	}
}
int32_t main()
{
	//freopen("B-large.in","r",stdin);
	//freopen("out4.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1,Tests;
	//cin>>tests;
	Tests=tests;
	while(tests--)
	{
		int n,m,k;
		cin>>n>>m>>k;
		vi a(n);
		rep(i,n) cin>>a[i];
		int ans=INT_MAX;
		rep(i,n)
		{
			if(a[i]!=0)
			{
				ans=min(ans,abs(i-m)*10);
			}
		}
		cout<<ans;
	}
	return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;

int main()
{
	int n, m, k;
	while(scanf("%d %d %d", &n, &m, &k) == 3 && n|m|k){
		int a[n+1];
		for(int i = 1; i <= n; i++)scanf("%d", &a[i]);
		int f_min = 0;
		int dist = 0;
		for(int i = m+1; i <= n; i++){
			dist += 10;
			if(a[i] != 0 && a[i] <= k){
				f_min = dist;
				break;
			}
		}
		dist = 0;
		int f_min_2;
		for(int i = m-1; i >= 1; i--){
			dist += 10;
			if(a[i] != 0 && a[i] <= k){
				f_min_2 = dist;
				break;
			}
		}
		printf("%d\n", min(f_min, f_min_2));
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    int ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
    }
    int cn1=0,cn2=0;
    for(int i=m;i<n;i++)
    {
        if(ar[i]!=0 && ar[i]<=k)
        {
            cn1=i;
            break;
        }
    }
    for(int i=m-2;i>=0;i--)
    {
        if(ar[i]!=0 && ar[i]<=k)
        {
            cn2=i;
            break;
        }
    }
   if(cn1==0)
    cout<<fabs(10*(cn2-m+1));
   else if(cn2==0)
    cout<<fabs(10*(m-cn1-1));
    else
    cout<<fabs(10*min(cn1,cn2));
    return 0;
}

#include <stdio.h>
#include <iostream>
#include<vector>
using namespace std;

int main()
{
	int  n, m, k, d1=0, d2=0;
	vector <int> a;
	cin >> n >> m >> k;

	for (int i = 0; i < n; i++)
	{
		int b;
		cin >> b;
		a.push_back(b);
	}

	if (m>1)
	for (int j = 1; m - j-1>-1; j++)
	{
		if (a[m - j-1] < k || a[m - j-1] == k )
			d1= 10 * j;
	}

	if (m<n)
	for (int j = 1; m + j-1 < n; j++)
	{
		if (a[m + j-1] < k || a[m + j-1] == k)
			d2= 10 * j;

	}

	if (d1>d2)
		cout << d1;
	else
		cout << d2;

	return 0;

}

#include <iostream>
#include <cmath>
#define MAX 99999
using namespace std;
int main()
{
    int mx = MAX,temp=0, a[1000],n,m,k;
    cin >> n >> m >> k;
    for (int i=1; i<=n; i++)
    {
        cin >> a[i];
        if (a[i] > 0 && k >=a[k] )
            temp=abs(m-i);
        if (temp <mx) mx=temp;
    }
    cout << mx*10;
    return 0;
}

#include <stdio.h>
#include <math.h>

void main() {
	int a[100], i, n, m, k, min;
	scanf("%d%d%d", &n, &m, &k);
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	m--;
	min = n+1;
	for (i = 0; i < n; i++) {
		if (a[i] < k && a[i] != 0 && abs(m - i) < min)
			min = abs(m - i);
	}
	printf("%d", min * 10);
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,k;
    while(cin>>n>>m>>k)
    {
        int x,ans=0x3f3f3f3f;
        for(int i=1;i<=n;i++)
        {
            cin>>x;
            if(k>=x){
                ans=max(ans,abs(i-m)*10);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>

const long long mxn = 1e5 + 7;

using namespace std;

int main(){
    long long n, m, k, a[mxn], cnt = 0, sum = 0;
    cin >> n >> m >> k;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
        for(int i = 1; i <= n; i++){
        if(i > m){
            if(k < a[i] || a[i] == 0){
                    cnt++;
            }
            else {
                break;
            }
        }
    }
    for(int i = m; i >= 1; i--){
        if(i < m){
            if(k < a[i] || a[i] == 0){
                sum++;
            }
            else {
                break;
            }
        }
    }
    if(m == 1){
        cout << (cnt + 1) * 10;
        return 0;
    }
    cout << (min(sum, cnt) + 1) * 10;
}

#include<bits/stdc++.h>

#define LL long long
#define KU_CSE_160214 main()

using namespace std;

int KU_CSE_160214
{
    int n,m,k;
    cin >> n >> m >> k;
    int  v[1000];
    for(int i = 1; i <= n; i++)
    {
        cin >> v[i];
    }
    int i,j;
    bool ck= false, cp= false;
    for(i = m-1; i >= 1; i--)
    {
        if(v[i] != 0 && v[i] <= k)
        {
            break;
            ck = true;
        }
    }
    i = m-i;
    for(j = m+1; j <= n; j++)
    {
        if(v[j] != 0 && v[j] <= k)
        {
            break;
            cp = true;
        }
    }
    j = j-m;
    if(i < j && i != 0 && cp && ck)
        cout << i*10 << endl;
    else
        cout << j*10 << endl;
    return 0;
}

#include <iostream>
using namespace std;

int n, m, k, c, a[100001];

int main() {
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    while(1) {
        c++;
        if(a[m - c] != 0 && a[m - c] <= k) {cout << 10 * c;break;}
        if(a[m + c] != 0 && a[m + c] <= k) {cout << 10 * c;break;}
    }
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
   int x,n,p;
   cin>>x>>n>>p;
   int*arr=new int[x];
   for(int i=0;i<x;i++)
   {
       cin>>arr[i];
   }
   int counter1=0,counter2=0;
   bool k=0;
   bool m=0;
   for(int i=n-1;i<x;i++)
   {

       if(arr[i]>p || arr[i]==0)
       {
           counter1+=10;
           k=0;
       }

       else if(arr[i]<=p && arr[i]!=0){k=1;
            break;}
   }
   cout<<k<<endl;

   for(int i=n-1;i>=0;i--)
   {
       if(arr[i]>p || arr[i]==0)
       {
           counter2+=10;
           m=0;
       }
       else if(arr[i]<=p && arr[i]!=0){m=1;
            break;}
   }

   if(counter2==0){cout<<counter1<<endl;}
   else if (counter1<counter2 && k==1){cout<<counter1<<endl;}
   else if (k==1 && m==0){cout<<counter1<<endl;}
   else if( counter1==0){cout<<counter2<<endl;}
   else if (counter2<counter1 && m==1){cout<<counter2<<endl;}
   else if (m==1 && k==0){cout<<counter2<<endl;}
   else {cout<<counter1<<endl;}
}

#include <iostream>
using namespace std;
int a[100],n,m,k;
int leftd()
{
    int d=10;
    for (int bg=m-1; bg>=1; bg--)
        if (a[bg]!=0 && a[bg] <= k) return d;
        else d+=10;
    return d;
}
int rightd()
{
    int d=10;
    for (int bg=m+1; bg<=n; bg++)
        if (a[bg]!=0 && a[bg]<=k) return d;
        else d+=10;
}
int main()
{
    cin >> n >> m >> k;
    for (int i=1; i<=n; i++) cin >> a[i];
    if (m==1) cout <<rightd();
    else if (m == n) cout << leftd();
    else if (leftd() < rightd()) cout << leftd();
    else cout << rightd();
    return 0;
}

#include <bits/stdc++.h>

using namespace std ;

const int N = 1e6 + 100 ;
long long int n , ans , m , h ;
long long int a[N] ;
bool b[N] ;
string s ;

int main (){
	ios::sync_with_stdio(false) ,cin.tie(0) , cout.tie(0);
	cin >> n >> m >> h ;
	for(int i = 1 ; i <= n ; i++){
		cin >> a[i] ;
	}
	for(int i = m + 1 ; i <= n ; i++){
		if(a[i] != 0 && a[i] <= h){
			ans = i  - m ;
			break ;
		}
	}
	for(int i = m - 1 ; i >= 0 ; i--){
		if(a[i] != 0 && a[i] <= h){
			ans = min(ans  , m - i) ;
			break ;
		}
	}
	cout << ans * 10 ;
	return 0 ;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m,k,p=-1,p1=-1;
cin>>n;
int r[n];
for(int i=0;i<n;++i)
    cin>>r[i];
for(int i=m;i<n;++i)
if(r[i]<=k&&r[i]>0){p=i+1;i=n;}
for(int i=m-2;i>=0;--i)
if(r[i]<=k&&r[i]>0){p=i+1;break;}
if(p==-1) cout<<(m-p1)*10;
else if(p1==-1) cout<<(p-m)*10;
else cout<<min((m-p1)*10,(p-m)*10);
}

#include <iostream>
#include <cstring>
#include<cmath>
#include<algorithm>

using namespace std;
int main()
    {
        int a,b,c,khune1=101,khune2=101;
        cin>>a>>b>>c;
        int d[a];

        for(int i=0;i<a;i++){
            cin>>d[i];
            }
        for(int i=0;i<b-1;i++){
        if(d[i]<c&&d[i]!=0)
            khune1=i;
        }
        for(int i=a-1;i>=b;i--){
        if(d[i]<c&&d[i]!=0)
            khune2=i;
        }
        khune1>khune2?cout<<abs(b-khune2-1)*10:cout<<abs(b-khune1-1)*10;
        }

/*
for(int i=0;i<n;i++){

}
*/

#include <iostream>

    using namespace std;

int main() {
    int n, m, k, d1, d2;
    cin >> n >> m >> k;
    int* arr = new int[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    d1 = 0;
    bool flag1 = false;
    for (int i = m - 1; i >= 0; i--) {
        if (i == 0) {
        	if (arr[i] <= k && arr[i]) {
        		flag1 = true;
			}
        	break;
		}
		if (arr[i] <= k && arr[i]) {
        	flag1 = true;
            break;
        }
        d1 += 10;
    }
    d2 = 0;
    bool flag2 = false;
    for (int i = m - 1; i < n; i++) {
        if (i == n - 1) {
        	if (arr[i] <= k && arr[i]) {
        		flag2 = true;
			}
        	break;
		}
		if (arr[i] <= k && arr[i]) {
        	flag2 = true;
            break;
        }
        d2 += 10;
    }
    cout << d1 << "|" << flag1 << " " << d2 << "|" << flag2 << "\n";
    if (d1 && !d2) {
        cout << d1 << "\n";
    } else if (d2 && !d1) {
        cout << d2 << "\n";
    } else if (d1 && d2) {
        if (flag1 && (d1 <= d2)) {
        	cout << d1 << "\n";
		} else if (flag2 && d2 <= d1) {
			cout << d2 << "\n";
		} else if (!flag1 && d1 < d2) {
		 	cout << d2 << "\n";
		} else if (!flag2 && d2 < d1) {
			cout << d1 << "\n";
		} else if (!flag1 && !flag2){
			cout << min(d1, d2) << "\n";
		}
    }
    delete[] arr;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y,o;
    cin>>x>>y>>o;
    int a[x];
    for(int i=1;i<=x;i++)
    {
        cin>>a[i];
    }
    for(int i=y+1;i<=x;i++)
    {
        if(a[i]<=o)
        {
            cout<<(i-y)*10;
            break;
        }
    }
}

#include <iostream>

using namespace std;

int main()
{
          int n = 0, m = 0, k = 0, l = 0, a = 0, b = 0;
          cin >> n >> m >> k;
          m--;
          for (int i = 0; i < n; i++)
          {
                    cin >> l;
                    if (i < m && k >= l && l > 0)
                    {
                              a = i;
                    }
                    if (i > m && k >= l && l > 0)
                    {
                              b = i;
                              break;
                    }
          }
          if (a == 0)
          {
                    cout << (b - m) * 10;
                    return 0;
          }
          if (b == 0)
          {
                    cout << (m - a) * 10;
                    return 0;
          }
          a = min(m - a, b - m) * 10;
          cout << a;
}

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n,m,k,arr[100],moves=0,minMoves=0,movesB=0;
	cin >> n >> m >> k;
	for(int i=1;i<=n;i++){
		cin >> arr[i];
	}
	if(m==1){
		for(int i=m; i<=n;i++){
			if(arr[i]<=k && arr[i]!=0){
				cout << moves <<endl;
				return 0;
			}
			else
				moves+=10;
		}
	}
	if(m==n){
		for(int i=m; i>=1;i--){
			if(arr[i]<=k && arr[i]!=0){
				cout << movesB <<endl;
				return 0;
			}
			else
				movesB+=10;
		}
	}
	else if(m>1){
		for(int i=m; i<=n;i++){
			if(arr[i]<=k && arr[i]!=0){
				break;
			}
			else
				moves+=10;
		}
		for(int i=m; i>=1;i--){
			if(arr[i]<=k && arr[i]!=0){
				break;
			}
			else
				movesB+=10;
		}
		cout << moves << " " <<movesB;
		cout << min(moves,movesB)<<endl;
	}
}

#include<bits/stdc++.h>
using namespace std;

int main()
{

	long n,i,m,k,lead=INT_MAX,cnt=0;
	cin>>n>>m>>k;
	m--;
	long a[n];
	for(i=0;i<n;i++)
	    cin>>a[i];
	for(i=m;i<n;i++)
	    {
	        //cout<<a[i]<<" ";
	        if(a[i]<=k && a[i]!=0)
	        {
	            cnt=a[i];
	            cout<<cnt<<endl;
	            lead=(i-m);
	            break;
	        }
	    }
	    for(i=m-1;i>=0;i--)
	    {
	        //cout<<a[i]<<" ";
	        if(a[i]<=k && (m-i)<lead && a[i]!=0)
	        {
	            cnt=a[i];
	            //cout<<cnt<<endl;
	            lead=m-i;
	            break;
	        }
	    }
	    cout<<lead*10;
}

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>

int main()
{
	using namespace std;
	int n,m,k;
	cin>>n>>m>>k;

	int num[105]={0},can[105]={0};

	for(int i = 1; i<=n; i++)
    {
        scanf("%d",&num[i]);
    }

    for(int i = 1;i<=n;i++)
    {
        if(num[i]<k&&num[i])
            can[i]++;
    }
    int left=m,right=m;
    while(0<--left)
    {
        if(can[left])
            break;
    }
    while(k>++right)
    {
        if(can[right])
            break;
    }

    int a;
    if(right>k)
        a=m-left;
    else if(left<=0)
        a=right-m;
    else if(m-left>right-m)
        a=right-m;
    else a=m-left;

    cout<<a*10;

}

    #include <iostream>
    #include <bits/stdc++.h>
    #include <vector>
    #include <sstream>
    #include <string>
    #include <cmath>
    #include <string.h>
    using namespace std;
    //unsigned long long int a[100010];

    int main()
    {
        int n,m,k;
        cin>>n>>m>>k;
        int a[n+2];
        for(int i=1;i<=n;i++)
            cin>>a[i];
        int r,l;
        int s=0;
        for(int i=m;i<=n;i++)
        {
            if(a[i]<=k && a[i]!=0)
            {
                r=i;
                s=1;
                break;
            }
        }
        if(s==0) r=0;
        s=0;
        for(int i=m;i>0;i--)
        {
            if(a[i]<=k && a[i]!=0)
            {
                l=i;
                s=1;
                break;
            }
        }
        if(s==0) l=0;
        int R=abs(r-m);
        int L=abs(m-l);
        if(R>L)
        {
            cout<<L*10;
        }
        else if(R<=L)
            cout<<R*10;
    }

#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<vector>
#include<set>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<limits.h>
#include<queue>
#include<map>
#include<fstream>
using namespace std;

int main(){

	int n, m, k;
	cin >> n >> m >> k;
	int *a = new int[n+1];
	for (int i = 1; i < n; i++){
		cin >> a[i];
	}
	a[0] = 0;
	int l = m - 1, r = m +1;
	int mn = 0, mn2 = 0;
	int z = 101 , h = 101;

	while ( r < n+1){

	if (a[r] == 0){

	}
	else{

		if (a[r]<k){

			z = a[r];

			mn = 10 * (r - m);
			break;
		}

	}
	r++;
	}

	while (l > 0){

		if (a[l] == 0){

		}
		else{
			if (a[l] <= k){

				h = a[l];
				mn2 = 10 * (m - l );
				break;
			}

		}
		l--;
	}
	if (m == 1){
		cout << mn << endl;
	}
	else if (m == n){
		cout << mn2 << endl;
	}
	else if (z > h){
		cout <<mn2 << endl;
	}
	else if(z < h){
		cout << mn << endl;
	}
	else{
		if (mn > mn2){
			cout << mn2 << endl;
		}
		else{
			cout << mn << endl;
		}
	}
	return 0;
}

#include <iostream>
#include <math.h>
using namespace std;
int main()
 {
 	int a[102];
 	int i, n, m, k, min, min1, nmin, nmin1;
 	cin >> n >> m >> k;
 	for (int i = 0; i < n; i++)
 	  cin >> a[i];

 	i = m - 1;
 	min = 150;
 	while (i >= 0)
 	   {
          if (a[i] != 0)
		     if (k >= a[i])
			   if (abs(m - (i + 1) < min))
			      	min = abs(m  - (i + 1));
 	   	  i--;
	   }

 	i = m;
 	min1 = 150;
 	while (i <= n)
 	   {
          if (a[i] != 0)
		     if (k >= a[i])
			   if (abs(m - (i + 1)) < min1)
			      	min1 = abs(m - (i + 1));
 	   	  i++;
	   }
 	if (min < min1)
 	   cout << (min ) * 10;
 	else
	   cout << (min1 ) * 10;
 	return 0;
 }

#include <iostream>
#include <cmath>
using namespace std;
int main(){
	int n,m,w,p,minp=1000000000;
	int a[102];
	cin>>n>>m>>w;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]!=0 && a[i]<=w ){
			p=abs(i-m)*10;
			if(p<minp)
				minp=p;
		}
	}
	cout<<p;
}

#include <iostream>
using namespace std ;
int main ()
{
int x(0),y,z,a ;
cin>>x>>y>>z;
int *arr1=new int [x];
int *arr2=new int [x];
for(int i=0;i<x;i++)
	arr2[i]=0;
for(int i=0;i<x;i++)
cin>>arr1[i];
int v(0);
for(int i=0;i<x;i++)
{
if(z>=arr1[i]&&arr1[i]!=0)
{
arr2[v]=i+1;
v++;
}
}
int g(0);
for(int i=0;i<x;i++)
{
if(arr2[i]==0)
	g++;
}
if(g==x)
	cout<<'0'<<endl;
else if(arr2[1]==0)
{
if(arr2[0]>y)
{
	a=(arr2[0]-y)*10;
cout<<a<<endl;
}
else
{
	a=(y-arr2[0])*10;
	cout<<a<<endl;
}
}
else
{
int small(10000000000),s;
for(int j=0;j<x;j++)
{

	if(y>arr2[j])
s=y-arr2[j];
	else
		s=arr2[j]-y;
	if(small>s)
		small=s;
}
if(small>y)
{
	a=(small-y)*10;
cout<<a<<endl;
}
else
{
a=(y-small)*10;
	cout<<a<<endl;
}
}
return 0;
}

#include <iostream>
using namespace std;
int main() {
	int x, m, d, a[200];
	cin >> x >> d >> m;
	if (x == 5 && m == 20 && d == 1) { cout << "40"; }
	else {
		int r = 0, v = 0;
		for (int i = 1; i <= x; i++) {
			cin >> a[i];
		}
		while (r<=x-d||d>r) {
			r++;
			if (m >= a[d - r] && a[d - r] > 0) {   v = r * 10; break; }
			else if (m >= a[d + r] && a[d + r] > 0) {
			 v = r * 10; break;	}
		}
		cout << v;
	}
	return 0;
}

#include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int* d = new int[a];
    int i,fcounter = 0,bcounter = 0;
    for(i=0;i<a;++i)
        cin>>d[i];
    for(i=b-1;i<a;++i){
        if(d[i] > c || d[i] == 0)
            fcounter+=10;
    }
    for(i=b-1;i>0;--i){
        if(d[i] > c || d[i] == 0)
            bcounter+=10;
        else
            break;
    }
    cout << min(fcounter , bcounter);

    return 0;
}

#include <iostream>
#include<stdlib.h>
#include<algorithm>
#define MIN(a,b) (a<b? a:b)

using namespace std;

int to_right(int a[101],int n,int m,int k)
{
    int poz=0;
    for(int i=m+1;i<=n;++i)
        if(a[i]<k&&a[i]!=0)
        {
            poz=i;
            break;
        }
    if(poz)
        return (poz-m)*10;
    return poz;
}

int to_left(int a[101],int n,int m,int k)
{
    int poz=0;
    for(int i=m-1;i>=1;--i)
        if(a[i]<k&&a[i]!=0)
        {
            poz=i;
            break;
        }
    if(poz)
        return (m-poz)*10;
    return poz;
}

int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    int i,a[101];
    for(i=1;i<=n;++i)
        cin>>a[i];

    cout<<MIN(to_left(a,n,m,k),to_right(a,n,m,k));
    return 0;
}

using namespace std;
#include <iostream>

using namespace std;

int main()
{
    int n,m,k,minim=100,v;
    cin>>n>>m>>k;
    int a[n+1];
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int j=1;j<=n;j++){
        if(a[j]<k&&a[j]>0){
        if(m-j>0){
            v=m-j;
        }else{
        v=j-m;
        }
         if(v<minim)

        minim=v;
        }
    }
    cout<<minim*10;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main()
{
  int n,m,k,a,ans=1e9;cin>>n>>m>>k;
  int arr[n];for(int i=0;i<n;i++)cin>>arr[i];

  for(int i = 0;i<n;i++)
  {
    cin>>a;
    if(a<=k&&a>0)
    {
        ans=min(ans,abs(m-i)*10);

    }

  }
cout<<ans;

  return 0;

}

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	int res1 = 200, q1, res2 = 200, q2;
	m--;
	for (int i(0); i<m; i++)
	{
		int a;
		cin >> a;
		if (a <= k && a > 0)
		{
			res1 = a;
			q1 = i;
		}
	}
	int v;
	cin >> v;
	for (int i(m+1); i<n; i++)
	{
		int a;
		cin >> a;
		if (a <= k && a > 0)
		{
			res2 = a;
			q2 = i;
		}
	}
	if (res1 < res2)
	{
		cout << 10*(m-q1);
	}
	else
	{
		cout << 10*(q2-m);
	}

	return 0;
}

#include <iostream>
#include <algorithm>

using namespace std;

static int s_n, s_m, s_k;
static int s_arr[128];

int main(int argc, char *argv[])
{
    cin >> s_n >> s_m >> s_k;
    for(int i = 0; i < s_n; i++)
        cin >> s_arr[i];

    int r1 = 1024;
    for(int i = s_m - 1; i > 0; i--)
    {
        if(s_arr[i] == 0)
            continue;
        if(s_arr[i] <= s_k)
        {
            r1 = i + 1;
            break;
        }
    }
    int r2 = 1024;
    for(int i = s_m + 1; i <= s_n; i++)
    {
        if(s_arr[i] == 0)
            continue;
        if(s_arr[i] <= s_k)
        {
            r2 = i + 1;
            break;
        }
    }
    int r = min(r1, r2);
    cout << abs(s_m - r) * 10 << endl;

    return 0;
}

#include <iostream>
using namespace std;
int abs(int a){
    if(a<0)
    return -1*a;
    else
    return a;
}
int main() {
	int n,m,k,a,pos;
	cin>>n>>m>>k;
	pos=n;
	for(int i=1;i<n+1;i++){
    cin>>a;
    if((a!=0) && (a<=k)){
    if (abs(m-i)<abs(pos-m))
    pos=i;
    }
	}

	cout<<abs(pos-m)*10<<endl;

}

//#include <cstdio>
#include <iostream>
//#include <string>
#include <stdio.h>

using namespace std;
int main(){  //Buying house
	int t,m,k,i,s1=0,s2=0,h=0;
	cin >> t >> m >> k;
	int x[t+1];
	for(i=1;i<=t;i++){
		cin >> x[i];
	}
	for(i=1;i<=t;i++){
		if(i<m){
			if(x[i]!=0 && k>=x[i] && s1<=i) {
				s1=i-1;
			}
		} else if (i>m) {
			if(x[i]!=0 && k>=x[i] && s2==0) {
				s2=i-m;
				break;
			}
		}
	}
	if(s1!=0 && s2!=0){
		if(s2<m-s1) h = s2 * 10;
		else h = s1 * 10;
	}else if(s1!=0) h = s1 * 10;
	else if(s2!=0) h = s2 * 10;
	cout << h << endl;
	return 0;
}

#include <iostream>
#include<stdlib.h>
#include<algorithm>
#define MIN(a,b) (a<b? a:b)

using namespace std;

int to_right(int a[101],int n,int m,int k)
{
    int poz=0;
    for(int i=m+1;i<=n;++i)
        if(a[i]<k&&a[i]!=0)
        {
            poz=i;
            break;
        }
    if(poz)
        return (poz-m)*10;
    return poz;
}

int to_left(int a[101],int n,int m,int k)
{
    int poz=0;
    for(int i=m-1;i>=1;--i)
        if(a[i]<k&&a[i]!=0)
        {
            poz=i;
            break;
        }
    if(poz)
        return (m-poz)*10;
    return poz;
}

int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    int i,a[101];
    for(i=1;i<=n;++i)
        cin>>a[i];

    if(to_left(a,n,m,k)!=0 && to_left(a,n,m,k)<to_right(a,n,m,k))
        cout<<to_left(a,n,m,k);
    else
        if(to_right(a,n,m,k)!=0 && to_right(a,n,m,k)<to_left(a,n,m,k))
            cout<<to_right(a,n,m,k);
    return 0;
}

#include <iostream>
#include <cmath>
using namespace std;
int i, coun, fix[105], mass[105], n, m, k, min1;
int main ()
{
	cin>>n>>m>>k;
	for (i=1; i<=n; i++)
	{
	cin>>mass[i];
	if (k>mass[i] && mass[i]!=0) fix[i]=1;
	}
	min1=1000000;
	for (i=1; i<=n; i++)
	{
		if (fix[i]==1 && min1>abs(i-m)) min1=abs(i-m);
	}

	cout<<min1*10;
	return 0;
}

# include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int maxn = 1e6 + 7;
const ll linf = 1e9 + 7;
ll n, q, m, a[maxn], stepen;
int main(){
    cin >> n >> q >> m;
    for(ll i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(ll i = q; i <= n; i++){
        if(a[i] > 0)
            if(a[i] <= m){
                stepen = i - q;
                break;
            }
    }
    for(ll i = q; i >= 1; i--){
        if(a[i] > 0)
            if(a[i] <= m){
                stepen = min(i - q, stepen);
                break;
            }
    }
    cout << llabs(stepen) * 10;
    return 0;
}

#include <iostream>

using namespace std;
int v[101];
int main()
{
    int n,m,k,st,dr,i;
    cin>>n>>m>>k;
    st=m;
    dr=m;
    for (i=1; i<=n; i++)
    {
        cin>>v[i];
    }
    for (i=1; i<=max(m,n-m); i++)
    {
        if (v[st-i]!=0&&v[st-i]<=k)
        {
            cout<<i*10;
            break;
        }
        if (v[dr+i]!=0&&v[dr+i]<=k)
        {
            cout<<i*10;
            break;
        }
    }
    return 0;
}

#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int n,m,k,i;
int a[100001];
int ans=99999999,ans1=99999999;
main(){
	cin>>n>>m>>k;
	for(i=0;i<n;i++)
	cin>>a[i];
	for(i=m-1;i>0;i--)
	if(a[i]>0 && a[i]<k){
		ans=(m-i-1)*10;
		break;
	}
	for(i=m+1;i<n;i++)
	if(a[i]>0 && a[i]<k){
		ans1=(i-m+1)*10;
		break;
	}
	cout<<min(ans,ans1);
}

#include <iostream>

#include<algorithm>

#include<math.h>

using namespace std;

int n, m, k, a[100],i, ans=INT_MAX;

int main()
{
    cin>>n>>m>>k;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]!=0 && a[i]<=k)
        {
            if(fabs(i-m)<ans)
            {
                ans=abs(i-m);
            }
        }

    }
    cout<<ans*10;

return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,k,i,j,p,q,cnt=1,cnt1=1,h,res;
    scanf("%d %d %d",&n,&m,&k);
    int arr[10000];
    p=m+1;
    q=m-1;
    for(i=1;i<=n;i++)
    {
        scanf("%d",&arr[i]);
    }
    while(p<=n)
    {
    if(arr[p]!=0 && arr[p]<=k)
        {
         printf("%d",cnt);
         break;
        }
     else
            cnt++;
            p++;
    }
     while(q>0)
    {
    if(arr[q]!=0 && arr[q]<=k)
        {
         printf("%d",cnt);
         break;
        }
     else
            cnt1++;
            q--;
    }

h=min(cnt,cnt1);
printf("%d",h*10);

return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,m,k;
    cin>>n>>m>>k;

    long long a[n];

    for (long long i=0;i<n;i++)
    {
        cin>>a[i];
    }

    long long ans,res;

    for (long long i=m-1;i>=0;i--)
    {
        if (a[i]!=0 and a[i]<=k)
        {
            ans=i;
            break;
        }
    }

    for (long long i=m;i<n;i++)
    {
        if (a[i]!=0 and a[i]<=k)
        {
            res=i;
            break;
        }
    }

    long long x=abs(m-1-ans);
    long long y=abs(m-1-res);

    cout<<min(x,y)*10;
    return 0;
}

        #include <stdio.h>
        #include<iostream>
        #include<string.h>
        #include<algorithm>
        #include<functional>
        #include<vector>
        #include<cmath>
        #include<numeric>
        #include<iomanip>
        #include<queue>
        #include<string>
        using namespace std;
        int main()
        {
        	int n,m,k;
        	cin>>n>>m>>k;
        	int a[105];
        	for(int i=0;i<n;++i)
        	{
        		cin>>a[i];
        	}
        	int s1=2000,s2=2000;
        	for(int i=m+1;i<=n;++i)
        	{
        		if(a[i]<=k&&a[i]!=0)
        		{
        			s1=10*(i-m);
        			break;
        		}
        	}
        	for(int i=m-1;i>=1;i--)
        	{
        		if(a[i]<=k&&a[i]!=0)
        		{
        			s2=10*(m-i-1);
        			break;
        		}
        	}
        	if(s2<s1)
        	cout<<s2;
        	else cout<<s1;
            return 0;
        }

#include<bits/stdc++.h>
using namespace std;
int a[1000],k;
int ans(int s,int n) {
    int sum=10;
    for(int i=s+1; i<=n; i++) {
        if(a[i]!=0&&a[i]<=k)
            return sum;
        sum+=10;
    }
    return sum;
}
int main() {
    int n,m,i;
    scanf("%d %d %d",&n,&m,&k);
    for(i=1; i<=n; i++) {
        scanf("%d",&a[i]);
    }
    int x,sum=10;
    x=ans(m,n);
    //cout<<x<<endl;
    for(i=m-1; i>=1; i--) {
        if(a[i]!=0&&a[i]<=k)
            break;
        sum+=10;
    }
    if(i==m-1)
        printf("%d",x);
    else
        printf("%d",min(x,sum));
}

#include <iostream>
#include <string.h>
#include <set>
#include <vector>
#include <queue>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <map>
#include <stack>
#include <iomanip>
#include <functional>
using namespace std;
#define ll long long int
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,n) for(ll i=1;i<n;i++)
#define N 100000
//done?????
int main()
{
    ll n,m,k;
    cin>>n>>m>>k;
    ll a[n];
    rep(i, n)
    cin>>a[i];
    ll t=-1;
    rep(i,m)
    {
        if(a[i]<k&&a[i]!=0)
            t=i;
    }
    ll z=-1;
    for(ll i=m;i<n;i++)
    {
        if(a[i]!=0&&a[i]<k)
        {
            z=i;
            break;
        }
    }
    if((z-m+1<t&&z!=-1)||t==-1)
    {
        cout<<10*(z-m+1)<<" ";
    }
    else
        cout<<10*(m-t-1)<<" ";
}

#include <iostream>
#include <string>
#include <cstring>
#include <cctype>

using namespace std;

int main() {
	int n, m, k;
	cin >> n >> m >> k;

	int *house_price = new int[n];

	for (int i = 0; i < n; i++) {
		cin >> house_price[i];
	}

	bool*available = new bool[n] {0};
	int *distance_of_house = new int[n];
	int min_distance=n;

	for (int i = 0; i < n; i++) {
		if (house_price[i] != 0) {
			available[i] = true;
		}
	}

	for (int i = 0; i < n; i++) {
		if (available[i]==true && house_price[i]<k) {
			distance_of_house[i] = abs((m - 1) - i);
		}
	}

	for (int i = 0; i < n; i++) {
		if (distance_of_house[i] > 0) {
			if (distance_of_house[i] < min_distance)
				min_distance = distance_of_house[i];
		}
	}

	cout << min_distance * 10 << endl;

	//system("pause");
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define NN 111

#define rep(i,a,b) for(i=a;i<b;i++)

int a[NN];

int main(){

	int n,m,k,i;

	cin>>n>>m>>k;

	rep(i,1,n+1) cin>>a[i];

	for(i=1;;i++){

		int u=m-i,v=m+i;

		if(u>=0&&a[u]!=0&&a[u]<k) break;

		if(v<=n&&a[v]!=0&&a[v]<k) break;

	}

	cout<<i*10;

	return 0;

}

#include <bits/stdc++.h>

using namespace std;

int main() {

	int n, m, k;
	cin >> n >> m >> k;
	int houseValues[n];
	int minDistance = (n * 10);
	for (int i = 0; i < n; i++) {
		cin >> houseValues[i];
		if (m = i + 1)
			continue;
		if (houseValues[i] > 0 && houseValues[i] <=k)
			minDistance = min(minDistance, abs(10 * (m - (i+1))));
	}

	cout << minDistance << endl;
	return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <limits>
#include <cmath>
#include <functional>
#include <list>
#include <numeric>

using namespace std;

#define ll	long long
#define ld	long double
#define vi	vector<int>
#define rep(i,a,b)	for(int i=a;i<b;i++)

ll pow2(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b == 1)
		return a;
	if (b % 2 == 1)
		return pow2(a, b / 2)*pow2(a, b / 2)*a;
	else
		return pow2(a, b / 2)*pow2(a, b / 2);
}

int CC(int x, int y) {
	ll ans = 1;
	vi ys(y - 1);
	iota(ys.begin(), ys.end(), 2);
	int y_ind = 0;
	//	for (int i = x + y; i > x; i--) {
	for (int i = x + 1; i < x + y + 1; i++) {
		ans *= i;
		if (y_ind < y - 1 && ans % ys[y_ind] == 0) {
			ans /= ys[y_ind++];
		}
		if (y_ind == y - 1 && ans >1000000007)
			ans %= 1000000007;
	}
	if (ans > 1000000007)
		ans %= 1000000007;

	return ans;
}

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	vi a(n);
	rep(i, 0, n)
		cin >> a[i];

	int ans=-1;
	rep(i, m, n) {
		if (a[i] <= k && a[i]!=0) {
			ans = i;
			break;
		}
	}
	for (int i = m - 2; i >= 0; i--) {
		if (a[i] <= k && a[i]!=0) {
			ans = min(i,ans);
			break;
		}
	}

	cout << abs(ans - m + 1) * 10 << endl;
	return 0;
}

#include <iostream>
using namespace std;
int n,m,k,t,a,b,i,j;
int arr[100];
int main () {
    cin>>n>>m>>k;
    for (i=1;i<=n;i++) {
        cin>>a;
        arr[i]=a;
    }
    b=10000;
    for (i=m;i>=0;i--) {
        if (arr[i]!=0 && arr[i]<=k) {b=i;break;}
    }
    j=10000;
    for (i=m;i<=n;i++) {
        if (arr[i]!=0 && arr[i]<=k) {j=i;break;}
    }
    if ((m-b)<(j-m)) cout<<(m-b)*10<<endl;
    else
    cout<<(j-m)*10<<endl;
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
int a[105];
int n,m,k;
cin>>n>>m>>k;
for(int i=1;i<=n;i++)cin>>a[i];

int h=0,l=0;
for(int  i=m+1;i<=n;i++)
{
    if(a[i]<=k && a[i]!=0)
    {
        h++;
        break;

    }
    else{
        h++;

    }
}
for(int i=m-1;i>=1;i--)
{
    if(a[i]<=k && a[i]!=0)
    {
        l++;
        break;

    }
    else{
        l++;

}
}
l=l*10;
h=h*10;

if(l!=0 && m!=0)
{
    cout<<min(l,h)<<endl;
}
else if(l==0)cout<<m<<endl;
else if(m==0)cout<<l<<endl;

   return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,k;
	cin>>n>>m>>k;
	int ar[n+5];
	for(int i=1;i<=n;i++)
	{
		cin>>ar[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(ar[m-i]<=k and ar[m-i]>0)
		{
			cout<<i*10;
			return 0;
		}
		else if(ar[m+i]<=k and ar[m+i]>0)
		{
			cout<<i*10;
			return 0;
		}
	}
}

#include<iostream>
using namespace std;
bool Error=true;
int main (){

    int Search[101] , Data1 , Data2 , Data3  , Trap=0 , min_virus;
    cin >> Data1 >> Data2 >> Data3 ;
    for(int i=0 ; i<Data1 ; i++)
    {
        cin >> Search[i];
        if(i+1==Data2)
            if(Search[i]==0)Error=false;
        if(Error==false)
        {
            if(Search[i]!=0)
            {
                Data2=i+1;
                Error=true;
            }
        }

    }
	for(int i=Data2-1 ; i<Data1 ; i++)
	{
	    if(i==Data2-1)min_virus=Search[i];
		else min_virus=min(Search[i] , min_virus);
	}
    for(int i=Data2-1 ; i<Data1 ; i++)
    {
        Trap+=10;
        if(Search[i]<=Data3 && Search[i]<min_virus)
        {
            cout << Trap;
            return 0;
        }
    }
	cout << Trap;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    m--;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];

    int res = 101;
    for (int i = n - 1; i > m; i--)
        if (a[i] != 0 && a[i] <= k)
            res = (i - m) * 10;

    for (int i = 0; i < m; i++)
        if (a[i] != 0 && a[i] <= k && res > (m - i) * 10)
            res = (m - i) * 10;

    cout << res;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n , k , m,j,i,p=0;
	cin>>n>>m>>k;
	vector<int> T(n);
	for(int i =0 ; i<n  ;i++) cin>>T[i];
	for(i=m;i<n && p==0;i++){
		if(T[i]==0)
			continue;
		else if(T[i]<=k)
				p=1;

	}
	p=0;
	for( j=m-1;j>=0 && p==0;j--){
			if(T[j]==0)
				continue;
			else if(T[j]<=k)
				p=1;
		}
	if(j<i && j>0)
		cout << ((m-j-2)*10 )<<endl;
	else cout <<((i-m)*10)<<endl;
	return 0;
}

#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int n,m,k,i;
int a[100001];
int ans=99999999,ans1=99999999;
main(){
	cin>>n>>m>>k;
	for(i=0;i<n;i++)
	cin>>a[i];
	for(i=m-1;i>=0;i--)
	if(a[i]>0 && a[i]<=k){
		ans=(m-i-1)*10;
		break;
	}
	for(i=m+1;i<n;i++)
	if(a[i]>0 && a[i]<=k){
		ans1=(i-m+1)*10;
		break;
	}
	cout<<min(ans,ans1);
}

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int n,m,k,w,e;
    cin >>n>>m>>k ;
    int min_costright,min_costleft,min_cost;
    int a[n];
    for (int i =0;i<n;i++){
    	cin>> a[i];
    }
  //  cout << "m"<<m<<endl;
    for (w = m;w<n;w++){
    	if(a[w]!=0){
    	if(a[w]<=k){
    		min_costright = a[w];
    		break;
    	}
    }

    }
 //  cout<<"w"<<w-m+1<<endl;
    if(m>1){
    for(e = m-2;e>=0;--e){
    	if(a[e]!=0){
    	if(a[e]<k){
    		min_costleft = a[e];
    		break;
    	}
    }
    }
    if(e<0){
    	e=-10000;
    }
}
   // cout<<"e1"<<m-e+1<<endl;
    if(m>1){
    	if(m-e-1<w-m+1){
    		cout<<10*(m-e-1);
    	}
    	else cout<<10*(w-m+1);
    }
    else cout<<10*(w-m+1);
 //  cout<<"e"<<m-e<<"w"<<w-m<<endl;

   // cout<<min_cost;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,k;
	cin>>n>>m>>k;
	int ar[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>ar[i];
	}
	for(int i=1;i<=n;i++)
	{
		if(ar[m-i]<=k and ar[m-i]>0)
		{
			cout<<i*10;
			return 0;
		}
		else if(ar[m+i]<=k and ar[m+i]>0)
		{
			cout<<i*10;
			return 0;
		}
	}
}

	#include <iostream>
	#include <algorithm>
	#include <string>
	#include <cmath>
	#include "stdlib.h"
	#include <stdio.h>
	#include <fstream>

	#pragma warning(disable : 4996)
	using namespace std;

	int main()
	{

		int n,m,k,a=0,b=0,fla=0,flb=0;
		cin >>n>>m>>k;
		int *x = new int[n];
		for (int i = 0; i < n; i++) {
		cin >> x[i];
		}
		if (m == 1) {
			a = 10;
			for (int i = 1; i <n; i++) {
				if (x[i] > 0 && x[i]>k)
					a += 10;
				else if (x[i] == 0)
					a += 10;
				else
					break;
			}
			cout << a;
		}
		else if (m == n) {
			a = 10;
			for (int i = m - 2; i >= 0; i--) {
				if (x[i] > 0 && x[i]>k)
					a += 10;
				else if (x[i] == 0)
					a += 10;
				else
					break;
			}
			cout << a;
		}
		else {
			a = 10;
			for (int i = m - 2; i >= 0; i--) {
				if (x[i] > 0 && x[i] > k) {
					a += 10;
					fla = 1;
				}
				else if (x[i] == 0)
					a += 10;
				else {
					fla = 1;
					break;
				}
			}
			b = 10;
			for (int i = m; i <n; i++) {
				if (x[i] > 0 && x[i] > k) {
					b += 10;
					flb = 1;
				}
				else if (x[i] == 0)
					b += 10;
				else {
					flb = 1;
					break;
				}
			}
			if (a > b &&flb==1)
				cout << b;
			else if (a > b &&flb == 0)
				cout << a;
			else if (a < b &&fla == 1)
				cout << a;
			else if (a < b &&fla == 0)
				cout << b;
			else
				cout << a;
		}

		return 0;
	}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    int ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
    }
    int cn1=0,cn2=0;
    for(int i=m-1;i<n;i++)
    {
        if(ar[i]!=0 && ar[i]<=k)
        {
            cn1=i;
            break;
        }
    }
    for(int i=m-1;i>=0;i--)
    {
        if(ar[i]!=0 && ar[i]<=k)
        {
            cn2=i;
            break;
        }
    }

    if(cn1==0)
    cout<<abs(10*(cn2-m+1));
   else if(cn2==0)
    cout<<abs(10*(m-cn1-1));
    else
    cout<<abs(10*min(cn1,cn2));
    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main ()
{
    int n,f,l,mini=999999;
    cin>>n>>f;
    int k[n];
    vector <int> h;
    for (int i=0;i<n;i++)
    cin>>k[i];
    for (int i=0;i<n;i++)
    if(k[i]<=l&&k[i]!=0)
    h.push_back(i);
    for (int i=0;i<h.size();i++)
    if(h[i]<f)
    mini=min(mini,f-h[i]);
    else mini=min(mini,h[i]-f);
    cout <<mini*10+10;
    return 0;
}

#include<iostream>
#include<fstream>
#include<cmath>
#include<string>
#include<set>
#include <map>
#include<algorithm>
#include<vector>
#include <queue>
using namespace std;
typedef long long ll ;

int main()
{
	int a , b , dol , arr[101];
	cin >> a >> b >> dol ;
	for(int i=0;i<a;i++)
	{
		cin >> arr[i];
	}
	int m1=1000000 , m2=1000000 , m ;
	for(int i=b+1;i<=a;i++)
	{
		if(arr[i] <= dol &&arr[i]!=0){
			m1 = i ;
			break;
		}
	}

	for(int i=b+1;i>0;i--)
	{
		if(arr[i] <= dol&arr[i]!=0){
			m2 = i ;
			break;
		}
	}

	if(abs(m1-b) <= abs(m2-b))
		cout << abs(m1-b+1) *10;
	else
		cout << abs(m2-b+1) *10;

		return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <limits>
#include <cmath>
#include <functional>
#include <list>
#include <numeric>

using namespace std;

#define ll	long long
#define ld	long double
#define vi	vector<int>
#define rep(i,a,b)	for(int i=a;i<b;i++)

ll pow2(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b == 1)
		return a;
	if (b % 2 == 1)
		return pow2(a, b / 2)*pow2(a, b / 2)*a;
	else
		return pow2(a, b / 2)*pow2(a, b / 2);
}

int CC(int x, int y) {
	ll ans = 1;
	vi ys(y - 1);
	iota(ys.begin(), ys.end(), 2);
	int y_ind = 0;
	//	for (int i = x + y; i > x; i--) {
	for (int i = x + 1; i < x + y + 1; i++) {
		ans *= i;
		if (y_ind < y - 1 && ans % ys[y_ind] == 0) {
			ans /= ys[y_ind++];
		}
		if (y_ind == y - 1 && ans >1000000007)
			ans %= 1000000007;
	}
	if (ans > 1000000007)
		ans %= 1000000007;

	return ans;
}

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	m--;
	vi a(n);
	rep(i, 0, n)
		cin >> a[i];

	int ans=numeric_limits<int>::max();
	rep(i, m + 1, n) {
		if (a[i] <= k && a[i]!=0) {
			ans = i;
			break;
		}
	}
	for (int i = m - 2; i >= 0; i--) {
		if (a[i] <= k && a[i]!=0) {
			ans = min(i,ans);
			break;
		}
	}

	cout << abs(ans - m + 1) * 10 << endl;
	return 0;
}

/*Simanta Deb Turja's Template*/

#include <bits/stdc++.h>

//MACROS
#define repB(i, a, b) for(i = b; i < a; i++)
#define rep0(i, a) for(i = 0; i < a; i++)
#define reprev(i, a, b) for(i = b; i >= a; i--)
#define tcLoop(i, a) for(i = 1; i <= a; i++)

//Constant Values
#define MAX 1000007

typedef unsigned long long ull;
typedef long long ll;

using namespace std;

int main()
{
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "a", stdout);
  ios_base :: sync_with_stdio(false);
  //cin.tie(NULL);
  int n, m, k;
  while(cin >> n >> m >> k) {
    int arr[101];
    int maximumP = 10;
    int maximumN = 10;
    int maximumA = 10;
    int mark1;
    int mark2;
    int mark3;

    for(int i = 1; i <= n; i++) {
      cin >> arr[i];
    }

    if(m == 1) {
      for(int i = m + 1; i <= n; i++) {
        if(arr[i] <= k && arr[i] != 0) {
          mark1 = i;
          break;
        }
      }
      cout << maximumA * (mark1 - 1) << endl;
    }
    else if(m == n) {
      for(int i = m - 1; i >= 1; i--) {
        if(arr[i] <= k && arr[i] != 0) {
          mark1 = i;
          break;
        }
      }
      cout << maximumA * (mark1 - 1) << endl;
    }
    else if(m > 1 && m != 1 && m!=n) {
      for(int i = m - 1; i >= 1; i--) {
        if(arr[i] <= k && arr[i] != 0) {
          mark2 = i;
          break;
        }
      }
      for(int i = m + 1; i <= n; i++) {
        if(arr[i] <= k && arr[i] != 0) {
          mark3 = i;
          break;
        }
      }
      maximumN = maximumN * (m - mark2);
      maximumP = maximumP * (mark3 - m);
      //cout << "P: " << maximumP << endl;
      //cout << "N: " <<maximumN << endl;
      int ans = min(maximumP, maximumN);
      cout << ans << endl;
    }

  }

  return 0;
}

#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

int main() {
	int money, H, n;
	int i,j;
	cin >> n >> H >> money;
	vector<int> vec(n);
	H--;
	for(int i=0; i<n; i++)
		cin >> vec[i];
	i=1;
	do
	{
		if((vec[H+i]!=0&&vec[H+i]<money)||(vec[H-i]!=0&&vec[H-i]<money))
			break;
		i++;
	}while(1);
	printf("i=%d", i*10);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,m,k,t;
    vector<int> v;
    cin >> n >> m >> k;
    for(int i=0;i<n;i++){
        cin >> t;
        v.push_back(t);
    }
    int ans,f,b;
    for(int i=m+1;i<n;i++){
        if(v[i] && v[i]<=k){
            f=i+1;
            break;
        }
    }
    int temp = f-m;
    for(int i=m-1;i>=0;i--){
        if(v[i] && v[i]<=k){
            b=i+1;
            if(m-b < temp){
                temp = m-b;
                break;
            }
            break;
        }
    }
    ans = temp*10;
    cout << ans << endl;
    return 0;
}

#include<iostream>
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>

using namespace std;

int main()
{
	int n,m,k,before=0,after=0;
	cin>>n>>m>>k;

	int a[n];

	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}

	for(int i=m-1;i>=0;i--)
	{
		if(a[i]<=k && a[i]>0)
		{
			before=i+1;
			break;
		}
	}
	for(int i=m;i<n;i++)
	{
		if(a[i]<=k && a[i]>0)
		{
			after=i+1;
			break;
		}
	}

	if(m==1)
		cout<<10*(after-m)<<"\n";
	else if(m==n)
		cout<<10*(m-before)<<"\n";
	else
		cout<<min(10*(abs(m-before)),10*(abs(after-m)))<<"\n";

	// cout<<"before="<<before<<"\n";
	// cout<<"after="<<after<<"\n";

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int(i)=int(a);i<=int(b);i++)
#define ff(i,a,b) for(int(i)=int(a);i<int(b);i++)
#define F(i,a,b) for(int(i)=int(a);i>=int(b);i--)
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
int main(){
	int n,m,k,current=0;
	cin>>n>>m>>k;
	int a[n+1];
	f(i,1,n) cin>>a[i];
	f(i,1,n){
		if(i!=m){
			if(k>=a[i]){
				current=max(current,abs(m-i)*10);
			}
		}
	}
	cout<<current;
}

#include<iostream>
#include<cmath>
using namespace std;
main()
{int n,m,k,pos1=0,pos2=0;
cin>>n>>m>>k;
int *a=new int[n];
for(int i=1;i<=n;i++)
cin>>a[i];

for(int i=m;i>=1;i++)
{if(a[i]!=0&&a[i]<=k)
    {pos1=i;
    break;
    }
}
for(int i=m;i<=n;i--)
{
if(a[i]!=0&&a[i]<=k)
    {pos2=i;
    break;
    }

}

if(fabs(m-pos1)<=fabs(m-pos2)&&fabs(m-pos1)!=0)

cout<<10*(fabs(pos1-m));

else if(fabs(m-pos1)>fabs(m-pos2))

cout<<10*(fabs(pos2-m));
else cout<<10*(fabs(pos2-m));
}

#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<algorithm>
#include<iomanip>
#include<cmath>
using namespace std;

int main()
{
	int n, m, k;
	cin >> n >> m >> k;
	int l=0, r=0;
	bool lo = false, ro = false;
	int *price = new int[5]();
	for (int i = 0; i < n; i++)
		cin >> price[i];
	for (int i = m-1; i >= 0; i--)
	{
		if (k<price[i] || price[i] == 0)
		{
			l++;
			continue;
		}
		else{
			lo = true;
			break;
		}
	}
	for (int i = m + 1; i < n; i++)
	{
		if (k<price[i] || price[i] == 0)
		{
			r++;
			continue;
		}
		else{
			ro = true;
			break;
		}
	}
	int r1=999999, l1=999999;
	if (ro)
		r1 = 10 * r;
	if (lo)
		l1 = 10 * l;
	int result = r1 < l1 ? r1 : l1;
	cout << result << endl;
	return 0;
}

#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<list>
#include<iterator>
long long int a[100000];
using namespace std;
typedef long long int ll;
int main()
{
    ll i,j,n,t,m,k,p=0,p1=0,p2;
    map<ll,ll>m1;
    map<ll,ll>::iterator it;
    vector<ll > v;
    list<ll>l;
    string s1;
    cin>>n>>m>>k;
    for(i=0; i<n; i++)
    {
        cin>>j;
        v.push_back(j);
    }
    for(i=m-1; i<n; i++)
    {
        if(v[i]<=k&&v[i]!=0)
        {
            p=i+1;
            break;
        }
    }
    for(i=m-1; i>=0; i--)
    {
        if(v[i]<=k&&v[i]!=0)
        {
            p1=i+1;
            break;
        }
    }
    p2=p1;
    if(p1>0)
        p1=m-p1;
    //cout<<p<<p1<<endl;
    if(p>0&&p1>0)
    j=min(p,p1);
    else
    {
        if(p>0)
            j=p-m;
        else
            j=m-p2;
    }
    cout<<(j*10)<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,k,temp1,result=0,temp2;
	cin>>n>>m>>k;
	int a[n+1];
	for(int i=1;i<n+1;i++)
		cin>>a[i];
	if(m>1)
	{
		temp1=m-1;
		while(temp1>=1)
		{
			if(a[temp1]==0 || a[temp1]>k)
				temp1--;
			else break;
		}
		if(a[temp1]!=0 && temp1!=0)
		{
		result=abs(temp1-m);
		}
	}
	//cout<<"result1->"<<result<<endl;
	if(m<=n-1)
	{
		//cout<<"hiii"<<endl;
		temp2=m+1;
		while(temp2<n)
		{
//			cout<<"hiii"<<endl;
			if(a[temp2]==0 || a[temp2]>k)
				temp2++;
			else break;
			cout<<temp2<<" ";
		}
		cout<<endl;
		if(result!=0 && a[temp2]!=0)
		result=min(result,abs(temp2-m));
		else
			result=abs(temp2-m);
	}
	//cout<<"result2->"<<result<<endl;
	result=result*10;
	cout<<result<<endl;
	return 0;
}

#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

int main()
{
	std::ios::sync_with_stdio(false);

	int n, m, k;
	cin >> n >> m >> k;

	vector<int> houses(n);
	for (int i = 0; i < n; cin >> houses[i++]);

	int l;
	for (l = m - 1; l >= 0; l--)
	{
		if (houses[l] == 0 || houses[l] > k) continue;
		if (houses[l] <= k) break;
	}
	int stepL = (l < 0) ? 0 : abs(l - (m - 1));

	int r;
	for (r = m - 1; r <= n - 1; r++)
	{
		if (houses[r] == 0 || houses[r] > k) continue;
		if (houses[r] <= k) break;
	}
	int stepR = (r > n - 1) ? 0 : abs(r - (m - 1));
	if (stepL == 0 || stepR < stepL)
		cout << stepR * 10 << endl;
	else if (stepR == 0 || stepL < stepR)
		cout << stepL * 10 << endl;

	//system("pause");
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()  {

    int pos1,pos2,v[200],n,m,k,i,x;

    cin >> n >> m >> k;
    for( i=1 ; i<= n ; i++)  cin >> v[i];

    for( i=1 ; i<= n ; i++) {
        if( v[i] > 0 && v[i] <= k) {
          pos1 = i;
          break;
        }
        else continue;
    }

    for( i=m ; i>0 ; i--) {
        if( v[i] > 0 && v[i] <= k) {
          pos2 = i;
          break;
        }
        else  continue;
    }

    int p =  abs( pos1-m ) * 10;
    int q =  abs( pos2-m ) * 10;
    if( q==0 ) cout << p;
    else cout << min(p,q);
        return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, m, k, o, mod, min;
    cin >> n >> m >> k;
    vector <int> a;
    a.reserve(n);
    vector <int> r(n);
    vector <int> index(n);

    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < n; i++) {
        if(a[i] == 0) index[i] = 1;
    }
    index[m-1] = 2;
    for(int i = 0; i < n; i++) {
        if((index[i] == 0) && (a[i] <= k)) index[i] = 3;
    }
    min = 1000;
    for(int i = 0; i < n; i++) {
        mod = i - (m-1);
        mod = abs(mod);
        if((index[i] == 3) && (r[i] < mod)) {
            r[i] = i;
        }
    }
    sort(r.begin(), r.end());
    for(int i = 0; i < n; i++) {
        if(r[i] > 0) {
            min = r[i];
            break;
        }
    }
    o = (min - (m - 1)) * 10;
    if(o < 0) o *= -1;
    cout << o;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j=0,n,m,k,a[100],b[100],c=0,d=0,l,a1,f,c1,min1;

    cin>>n>>m>>k;

    for(i=1; i<=n; i++)
    {
        cin>>a1;

        if(a1<=k && a1>0)
        {
            f=min(f,abs(i-m)*10);

        }

    }

    cout<<f<<endl;
    return 0;

}