// https://atcoder.jp/contests/arc098/tasks/arc098_c

#include <iostream>
#include <string>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <set>
 
using namespace std;
using INT = long long int;
const INT INF = INT(1) << 60;

template< typename T1, typename T2 >
INT ret_f ( T1 ax, T2 mx, INT idx, INT i ){
    auto m   = mx[idx].first;
    auto a_i = mx[idx].second;

    if( m == ax[a_i] ){
        if( i == 1 ){
            return m;
        } else {
            if( idx+1 >= mx.size() ){ throw 0; }
            return ret_f( ax, mx, idx+1, i-1 );
        }
    } else {
        if( idx+1+i >= mx.size() ){ throw 0; }
        return ret_f( ax, mx, idx+1, i);
    }
}

int main(void){
    INT N, K, Q;

    cin >> N >> K >> Q;
    vector<INT> ax(N);
    vector< pair<INT, INT> > mx(N);

    INT a;
    for( INT i = 0; i < N; i++ ){
        cin >> a;
        ax[i] = a;
        mx[i].first = a;
        mx[i].second = i;
    }

    std::sort( mx.begin(), mx.end(), [](auto p1, auto p2){ return p1.first < p2.first; });
        
    vector<INT> ret;
    try {
        for( INT i = 0; i < N - K; i++ ){
            auto m     = mx[i].first;
            auto m2_i  = mx[i].second;
            auto m2    = ax[m2_i];

            if( m == m2 ){
                auto mk = ret_f( ax, mx, i, Q );
                ret.push_back( mk - m );

                ax[m2_i] = INF;
                INT tmp = K/2 + (K%2 == 0 ? 0 : 1); //  ceil の変わり
                for( INT j = 1; j < tmp; j++ ){

                    if( m2_i + j < N ){
                        ax[m2_i + j] = INF;
                    }
                    if( 0 <= m2_i - j ){
                        ax[m2_i - j] = INF;
                    }
                }
            }
        }
    } catch (...){ }

    // for( auto t : ret ){
    //     cout << t << endl;
    // }

    cout << *std::min_element(ret.begin(), ret.end()) << endl;

    return 0;
}

