#include <bits/stdc++.h>
using namespace std;
struct dd{
int x,y;
}a[1000010];
int main(){
int n,x1,y1,x2,y2,xb=0,yb=0;
cin>>x1>>y1>>x2>>y2>>n;
for(int i=0;i<n;i++){
cin>>a[i].x>>a[i].y;
int c,s;
c=pow(x1-a[i].x,2)+pow(y1-a[i].y,2);
s=pow(x2-a[i].x,2)+pow(y2-a[i].y,2);
if(c>s){
if(yb<s){
yb=s;
}
}else{
if(xb<c){
xb=c;
}
}
}
cout<<xb+yb;
}