#include using namespace std; using Int = long long; //INSERT ABOVE HERE template struct MonotoneMinima{ using F = function; int n; F dist; T INF; vector dp; MonotoneMinima(int n,F dist,T INF): n(n),dist(dist),INF(INF),dp(n+1,INF){} void dfs(int l,int r,int a,int b){ if(l==r) return; int m=(l+r)>>1; T ma=INF; int mi=-1; for(int i=a;i>1; solve(m,r); dfs(l,m,m,r); solve(l,m); } T solve(){ dp[n]=0; solve(0,n); return dp[0]; } }; signed main(){ int n; cin>>n; vector a(n),x(n),y(n); for(int i=0;i>a[i]; for(int i=0;i>x[i]; for(int i=0;i>y[i]; auto dist= [&](int i,int j)->Int{ Int s=abs(a[i]-x[j]); Int t=abs(y[j]); return s*s+t*t; }; const Int INF = 1e18; MonotoneMinima monge(n,dist,INF); cout<