#pragma region Region_1

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
using ll = long long;
using P = pair<ll, ll>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VP = vector<P>;
using VS = vector<string>;
using VC = vector<char>;
using VVC = vector<vector<char>>;
#define MOD 1000000007
const int INF = (int)1e9 + 10;         // int max > 2*10^9
const long long INFL = (ll)2e18 + 10;  // ll max > 9*10^18

template <class T, class C>
bool chmax(T& a, C b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T, class C>
bool chmin(T& a, C b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
T sum(const vector<T>& v) {
    T res = 0;
    for (size_t i = 0; i < v.size(); ++i) res += v[i];
    return res;
}

/////////////////////////////////////////////////////////
// print like python
// https://qiita.com/Lily0727K/items/06cb1d6da8a436369eed
/////////////////////////////////////////////////////////
void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << " ";
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T>& vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << " ";
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>>& df) {
    for (auto& vec : df) {
        print(vec);
    }
}

#pragma endregion Region_1
/////////////////////////////////////////////////////////
const double PI = M_PI;

int main() {
    std::cout << std::setprecision(15);
    //////////////////////////////////////////
    int n;
    cin >> n;
    double x0, y0, x2, y2;
    cin >> x0 >> y0 >> x2 >> y2;
    double xo = (x0 + x2) / 2;
    double yo = (y0 + y2) / 2;
    // print("o", xo,yo);
    double x02 = x0 - xo;
    double y02 = y0 - yo;
    double theta = (PI*(double)2) / (double)n;
    double x1 = x02 * cos(theta) - y02 * sin(theta);
    double y1 = x02 * sin(theta) + y02 * cos(theta);
    x1 += xo;
    y1 += yo;
    print(x1, y1);

    return 0;
}

#include <bits/stdc++.h>
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(),(x).end()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
using namespace std;
typedef double DB;
typedef long double LD;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<PII> VPII;
// head
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vector<LL> a(n+1);
    LL t=0,tt=0;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=2;i<=n;i++) {
        t+=(a[i]-a[1])*(a[i]-a[1]);
        tt+=(a[i]-a[1]);
    }
    LL res=t;
    for(int i=3;i<=n;i++) {
        tt+=a[i-2]-a[i-1];
        t=t-(a[i-1]-a[i-2])*(a[i-1]-a[i-2])+(a[i-2]-a[i-1])*(a[i-2]-a[i-1])*(n-i+1)+2*(a[i-2]-a[i-1])*tt;
        res+=t;
        tt+=(a[i-2]-a[i-1])*(n-i+1);

    }
    cout<<res<<'\n';
    return 0;
}