/// 407!3 +/ \!<07!\*
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using db = long double;
using str = string;
using pi = pair<int,int>;
using pd = pair<db, db>;
using vi = vector<int>;
using vpi = vector<pi>;
using vpd = vector<pair<db, db>>;
using vvi = vector<vi>;
#define f first
#define s second
#define sz(x) int((x).size())
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define rall(x) x.rbegin(), x.rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define pb push_back
#define er erase
#define ub upper_bound
#define lb lower_bound
#define FOR(i,a,b) for (ll i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (ll i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

const int MOD = 1e9+7; // 998244353;
const int MX = 2e5+5;
const ll INF = 1e18;
const char nl = '\n';

db dist(pd a, pd b){
    return (a.f - b.f) * (a.f - b.f) + (a.s - b.s) * (a.s - b.s);
}

void solve(){
    int n, m, k;
    cin >> n >> m >> k;
    vpd a(n), b(m);
    F0R(i, n)cin >> a[i].f >> a[i].s;
    F0R(i, m)cin >> b[i].f >> b[i].s;
    if(n == m && n == 1){
        cout << dist(a[0], b[0]);
    }
    sor(a);
    sor(b);
    if(a[0].f < b[0].f)cout << dist(a[n - k], b[k - 1]) << nl;
    else cout << dist(b[n - k], a[k - 1]) << nl;
}


/*
Nije isto kad flipujes...

*/

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t; t = 1;while(t--){
        solve();
    }
    return 0;
}