// Template v2
#define pb push_back
#define mp make_pair
#define first x
#define second y
#define l(x) x<<1
#define r(x) x<<1 | 1
#define lsb(x) x & -x
#include<bits/stdc++.h>
#include <bitset>
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PKK;
// primes less than 100
const int PRIM[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
const int CMAX = 10005;
const int MOD = 700001;
const int NMAX = 1e5 + 69;
const short INF16 = 32000;
const int INF = 2*1e9 + 6661369;
const LL INF64 = LL(1e18);
const LD EPS = 1e-9, PI = acos(-1.0);

double x[NMAX], y[NMAX];
int n;

const long double eps = 1e-9L;

double check(double a, double b)
{
    double rs=0;
    for(int i=1; i<=n; ++i)
        rs+=1.0L*(y[i]-(a*x[i]+b))*(y[i]-(a*x[i]+b));
    return rs;
}

double ternary(double a)
{
    double l=-1000000.0L;
    double r=1000000.0L;
    while(r-l>eps)
    {
        double p1=l+(r-l)/3;
        double p2=r-(r-l)/3;
        if(check(a, p1) < check(a, p2))
            r-=(r-l)/3;
        else
            l+=(r-l)/3;
    }
    return check(a,l);
}

void read()
{
    cin>>n;
    for(int i=1; i<=n; ++i)
        cin>>x[i]>>y[i];
        
    double l=-1000000.0L, r=1000000.0L;
    while(r-l>eps)
    {
        double p1=l+(r-l)/3;
        double p2=r-(r-l)/3;
        if(ternary(p1) < ternary(p2))
            r-=(r-l)/3;
        else
            l+=(r-l)/3;
    }
    cout<<ternary(l);
}
 
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cout<<setprecision(16);
    read();
     
    return 0;
}