#include <bits/stdc++.h>
#define pb push_back
#define ll long long int
#define pll pair<ll, ll>
#define all(x) x.begin(), x.end()

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n, m, k;
    cin>>n>>m>>k;
    vector<pair<pll, ll>> a1(n), a2(m);
    for(int i=0; i<n; i++)
    {
        ll x, y;
        cin>>x>>y;
        a1[i].first.first=x;
        a1[i].first.second=y;
        a1[i].second=i;
    }
    for(int i=0; i<m; i++)
    {
        ll x, y;
        cin>>x>>y;
        a2[i].first.first=x;
        a2[i].first.second=y;
        a2[i].second=i;
    }
    sort(all(a1));
    sort(all(a2));
    ll dy=(a1[0].first.second-a2[0].first.second)*(a1[0].first.second-a2[0].first.second);
    ll sum=k*dy;
    vector<pll> parovi;
    if(a1[n-1].first.first<=a2[0].first.first)
    {
        for(int i=1; i<=k; i++)
        {
            parovi.pb({a1[n-i].second, a2[k-i].second});
            sum+=(a1[n-i].first.first-a2[k-i].first.first)*(a1[n-i].first.first-a2[k-i].first.first);
        }
    }
    else if(a2[m-1].first.first<=a1[0].first.first)
    {
        for(int i=1; i<=k; i++)
        {
            parovi.pb({a2[m-i].second, a1[k-i].second});
            sum+=(a2[m-i].first.first-a1[k-i].first.first)*(a2[m-i].first.first-a1[k-i].first.first);
        }
    }
    cout<<sum<<"\n";
    for(auto u: parovi)
    {
        cout<<u.first<<" "<<u.second<<"\n";
    }

}