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

long long int w,h,n,x[100000+2],y[100000+2];
vector<long long int> zx,zy;
long long int Sx[100000+2],Sy[100000+2],R[100000+2],U[100000+2];
long long int sizx,sizy;

//long long int max(long long int p,long long int q){if(p<q)return q; return p;}

vector<long long int> e(vector<long long int> vll){
	vector<long long int> ret;
	ret.push_back(vll[0]);
	long long int s=vll.size();
	for(int i=1;i<s;i++){
		if(vll[i]!=vll[i-1])ret.push_back(vll[i]);
	}
	return ret;
}

long long int Sum_x(long long int p){
	long long int l=0,r=sizx-1;
	while(l<r){
		long long int s=(l+r+1)/2;
		if(zx[s]<=p)l=s;
		else r=s-1;
	}
	return Sx[l]+R[l]*(p-zx[l]);
}

long long int Sum_y(long long int p){
	long long int l=0,r=sizy-1;
	while(l<r){
		long long int s=(l+r+1)/2;
		if(zy[s]<=p)l=s;
		else r=s-1;
	}
	return Sy[l]+U[l]*(p-zy[l]);
}

long long int find_x(long long int l,long long int r,long long int p){
	long long int ret=-1;
	while(l<r){
		long long int s=(l+r)/2;
//		cout<<"test"<<l<<" "<<r<<endl;
		long long int LL=Sum_x(l)*2-max(l-p,p-l);
//		cout<<"test"<<l<<" "<<r<<endl;
		long long int RR=Sum_x(r)*2-max(r-p,p-r);
//		cout<<"test"<<l<<" "<<r<<endl;
		long long int SS=Sum_x(s)*2-max(s-p,p-s);
//		cout<<"test"<<l<<" "<<r<<endl;
		if(LL>=SS&&SS>=RR)l=s+1;
		else if(LL<=SS&&SS<=RR)r=s;
		else {
			long long int reta,retb;
			reta=find_x(l,s,p);
			retb=find_x(s+1,r,p);
			if(Sum_x(reta)*2-max(reta-p,p-reta)<Sum_x(retb)*2-max(retb-p,p-retb))ret=reta;
			else ret=retb;
			break;
		}
	}
	if(ret==-1)ret=l;
	while(Sum_x(ret-1)*2-max(ret-1-p,p-ret+1)==Sum_x(ret)*2-max(ret-p,p-ret)){ret--; cout<<ret<<endl;}
	return ret;
}

long long int find_y(long long int l,long long int r,long long int p){
	long long int ret=-1;
	while(l<r){
		long long int s=(l+r)/2;
		long long int LL=Sum_y(l)*2-max(l-p,p-l);
		long long int RR=Sum_y(r)*2-max(r-p,p-r);
		long long int SS=Sum_y(s)*2-max(s-p,p-s);
		if(LL>=SS&&SS>=RR)l=s+1;
		else if(LL<=SS&&SS<=RR)r=s;
		else {
			long long int reta,retb;
			reta=find_y(l,s,p);
			retb=find_y(s+1,r,p);
			if(Sum_y(reta)*2-max(reta-p,p-reta)<Sum_y(retb)*2-max(retb-p,p-retb))ret=reta;
			ret=retb;
			break;
		}
	}
	if(ret==-1)ret=l;
	while(Sum_y(ret-1)*2-max(ret-1-p,ret-p+1)==Sum_y(ret)*2-max(ret-p,p-ret)){ret--; cout<<ret<<endl;}
	return ret;
}

int main(){
	scanf("%lld%lld%lld",&w,&h,&n);
	R[0]=-n; U[0]=-n; Sx[0]=0; Sy[0]=0;
	for(int i=1;i<=n;i++){
		scanf("%lld%lld",&x[i],&y[i]);
		zx.push_back(x[i]);
		zy.push_back(y[i]);
		Sx[0]+=x[i];
		Sy[0]+=y[i];
	}
	zx.push_back(0);
	zy.push_back(0);
	sort(zx.begin(),zx.end());
	sort(zy.begin(),zy.end());
	sizx=zx.size();
	sizy=zy.size();
	long long int k=1;
	for(int i=1;k<sizx;i++){
		int t=1; k++;
		while(zx[k]==zx[k-1]){t++; k++;}
		R[i]=R[i-1]+2*t;
	}
	k=1;
	for(int i=1;k<sizy;i++){
		int t=1; k++;
		while(zy[k]==zy[k-1]){t++; k++;}
		U[i]=U[i-1]+2*t;
	}
	zx=e(zx);
	zy=e(zy);
	sizx=zx.size();
	sizy=zy.size();
//	cout<<"test"<<0<<endl;
	for(int i=1;i<sizx;i++)Sx[i]=Sx[i-1]+R[i-1]*(zx[i]-zx[i-1]);
	for(int i=1;i<sizy;i++)Sy[i]=Sy[i-1]+U[i-1]*(zy[i]-zy[i-1]);
/*	for(int i=0;i<sizx;i++)cout<<zx[i]<<" ";
	cout<<endl;
	for(int i=0;i<sizx;i++)cout<<Sx[i]<<" ";
	cout<<endl;
	for(int i=0;i<=sizx;i++)cout<<R[i]<<" ";
	cout<<endl;
	for(int i=1;i<=w;i++)cout<<Sum_x(i)<<" ";
	cout<<endl;
	for(int i=0;i<sizy;i++)cout<<zy[i]<<" ";
	cout<<endl;
	for(int i=0;i<sizy;i++)cout<<Sy[i]<<" ";
	cout<<endl;
	for(int i=0;i<=sizy;i++)cout<<U[i]<<" ";
	cout<<endl;
	for(int i=1;i<=h;i++)cout<<Sum_y(i)<<" ";
*///	cout<<endl;
	long long int ans=1000000000000000000,ansx,ansy;
	long long int Dx[4]={1,1,1,w},Dy[4]={1,1,1,h};
	for(int i=0;i<=sizx;i++)if(R[i]>=-1){Dx[1]=zx[i]; Dx[2]=zx[i+1]; break;}
	for(int i=0;i<=sizy;i++)if(U[i]>=-1){Dy[1]=zy[i]; Dy[2]=zy[i+1]; break;}
	for(int i=0;i<n;i++){
//		cout<<"test"<<i<<endl;
		long long int retx[3],rety[3],sumx[3],sumy[3],litx=1000000000000000000,lity=litx;
//		cout<<"test"<<i<<endl;
	//	retx=find_x(1,w,x[i+1]);
	//	cout<<Dx[0]<<" "<<Dx[1]<<" "<<Dx[2]<<" "<<Dx[3]<<endl;
	//	cout<<Dy[0]<<" "<<Dy[1]<<" "<<Dy[2]<<" "<<Dy[3]<<endl;
		for(int j=0;j<3;j++){
			retx[j]=find_x(Dx[j],Dx[j+1],x[i+1]);
	//		cout<<retx[j]<<endl;
			sumx[j]=Sum_x(retx[j])*2-max(x[i+1]-retx[j],retx[j]-x[i+1]);
			rety[j]=find_y(Dy[j],Dy[j+1],y[i+1]);
	//		cout<<rety[j]<<endl;
			sumy[j]=Sum_y(rety[j])*2-max(y[i+1]-rety[j],rety[j]-y[i+1]);
			litx=min(sumx[j],litx);
			lity=min(sumy[j],lity);
		}
		if(sumx[0]!=litx)retx[0]=1000000000000000000;
		if(sumy[0]!=lity)rety[0]=1000000000000000000;
		for(int j=1;j<3;j++){
			if(sumx[j]==litx)retx[0]=min(retx[j],retx[0]);
			if(sumy[j]==lity)rety[0]=min(rety[j],rety[0]);
		}
		sumx[0]=litx; sumy[0]=lity;
	/*	retx=find_x(1,Dx[0],x[i+1]);
		retx=min(find_x(Dx[0],Dx[1],x[i+1]),retx);
		retx=min(find_x(Dx[1],w,x[i+1]),retx);
//	*///	cout<<"test"<<i<<endl;
	//	rety=find_y(1,h,y[i+1]);
	/*	rety=find_y(1,Dy[0],y[i+1]);
		rety=min(find_y(Dy[0],Dy[1],y[i+1]),rety);
	*///	rety=min(find_y(Dy[1],h,y[i+1]),rety);
//		cout<<"test"<<i<<endl;
		sumx[0]=Sum_x(retx[0])*2-max(x[i+1]-retx[0],retx[0]-x[i+1]);
//		cout<<x[i]<<" "<<retx<<" "<<max(x[i]-retx,retx-x[i])<<endl;
		sumy[0]=Sum_y(rety[0])*2-max(y[i+1]-rety[0],rety[0]-y[i+1]);
//		cout<<y[i]<<" "<<rety<<" "<<max(y[i]-rety,rety-y[i])<<endl;
		if(ans>sumx[0]+sumy[0]){
			ans=sumx[0]+sumy[0];
			ansx=retx[0];
			ansy=rety[0];
		}
		if(ans==sumx[0]+sumy[0]){
			if(ansx>retx[0]||(ansx==retx[0]&&ansy>=rety[0])){
				ans=sumx[0]+sumy[0];
				ansx=retx[0];
				ansy=rety[0];
			}
		}
	//	cout<<i<<":"<<sumx[0]+sumy[0]<<" "<<retx[0]<<","<<rety[0]<<endl;
	}
	printf("%lld\n%lld %lld\n",ans,ansx,ansy);
}

Measured memory_bytes: 9436