#include <iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<array>
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
#define MAXN (int)2e5+5
using namespace std;
array<int,3> c1[MAXN],c2[MAXN];
int rx = 0, ry = 0;
bool s(array<int, 3>& a, array<int, 3>& b) {
	if (a[0] == b[0]) {
		return a[1] * ry > b[1] * ry;
	}
	return a[0] * rx > b[0] * rx;
}
int sq(int a) {
	return a * a;
}
int dis(array<int,3> a, array<int,3>b) {
	return sq(a[0]- b[0]) + sq(a[1]- b[1]);
}
void solve() {
	int n, m, k; cin >> n >> m >> k;
	for (int i = 1; i <= n; i++) {
		int a, b; cin >> a >> b;
		c1[i] = { a,b,i };
	}for (int i = 1; i <= m; i++) {
		int a, b; cin >> a >> b;
		c2[i] = { a,b,i };
	}
	if (k != 1) {
		rx = 1, ry = 0;
		sort(c1 + 1, c1 + n + 1);
		sort(c2 + 1, c2 + m + 1);
		int z = 0;
		vector<pii>v;
		if (c1[1][0] < c2[1][0]) {
			for (int i = n; i > n - k; i--) {
				z += dis(c1[i], c2[k - n + i]);
				v.emplace_back(c1[i][2], c2[k - n + i][2]);
			}
		}
		else {
			for (int i = m; i > m - k; i--) {
				z += dis(c2[i], c1[k - m + i]);
				v.emplace_back(c1[k - m + i][2],c2[i][2]);
			}
		}
		cout << z << '\n';
		for (auto& x : v) {
			cout << x.fi << ' ' << x.se << '\n';
		}return;
	}
	if (m > 1) {
		rx = c2[2][0] - c2[1][0];
		ry = c2[2][1] - c2[1][1];
	}
	sort(c2 + 1, c2 + m + 1, s);
	if (n > 1) {
		rx = c1[2][0] - c1[1][0];
		ry = c1[2][1] - c1[1][1];
	}
	sort(c1 + 1, c1 + n + 1, s);
	int j = 1;
	pii rez = { -1,-1 };
	int s = 1e18;
	for (int i = 1; i <= n; i++) {
		while (j > 1 && dis(c2[j - 1], c1[i]) < dis(c2[j], c1[i])) {
			j--;
		}while (j < m && dis(c2[j + 1], c1[i]) < dis(c2[j], c1[i])) {
			j++;
		}
		if (s >= dis(c2[j], c1[i])) {
			s = dis(c2[j], c1[i]);
			rez = { c1[i][2],c2[j][2]};
		}
	}
	cout << s << '\n';
	cout << rez.fi << ' ' << rez.se << '\n';
}
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int32_t T = 1;// cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}