// Problem: C - Squared Error
// Contest: AtCoder - AtCoder Beginner Contest 194
// URL: https://atcoder.jp/contests/abc194/tasks/abc194_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Date: 2021-03-09 12:52:00
// --------by Herio--------

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull; 
const int N=3e5+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define PII pair<int,int>
#define fi first
#define se second
#define pb emplace_back
#define SZ(a) (int)a.size()
#define IOS ios::sync_with_stdio(false),cin.tie(0) 
void Print(int *a,int n){
	for(int i=1;i<n;i++)
		printf("%d ",a[i]);
	printf("%d\n",a[n]); 
}
ll a[N],b[N],c[N];
int main(){
	int n;cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i],b[i]=a[i]+b[i-1],c[i]=c[i-1]+a[i]*a[i];
	ll s=0;
	for(int i=2;i<=n;i++){
		s+=(i-1)*a[i]*a[i]+c[i-1]-2*a[i]*b[i-1];
	}cout<<s<<'\n';
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#ifdef NO_PROBLEM_MAIN
#define DPRINTF(x) printf x
#else
static inline void nop() { return; }
#define DPRINTF(x) nop()
#endif

#define SOLVER(x) solve_D x

static void s_shuffle( string &s, int r )
{
    int l = s.length();
    for ( int i = 0; i < r; i++ )
    {
        int x, y;
        x = random() % l;
        y = random() % l;
        swap( s[x], s[y] );
    }
}

static void s_solve(void)
{
    int si, sj, ti, tj;
    int x, y;
    string s;

    srandom(19750220);

    for ( int i = 0; i < 1000; i++ )
    {
        cin >> si >> sj >> ti >> tj;
        x = tj - sj;
        y = ti - si;
        s = "";
        if ( x > 0 )
        {
            for ( int j = 0; j < x; j++ )
            {
                s += "R";
            }
        }
        else
        {
            for ( int j = x; j < 0; j++ )
            {
                s += "L";
            }
        }
        if ( y > 0 )
        {
            for ( int j = 0; j < y; j++ )
            {
                s += "D";
            }
        }
        else
        {
            for ( int j = y; j < 0; j++ )
            {
                s += "U";
            }
        }

        s_shuffle( s, 100 );
        cout << s << endl;
        fflush(stdout);

        long long b;
        cin >> b;
    }
}

void SOLVER((volatile bool *do_loop))
{
    do {
        s_solve();
    } while ((do_loop != NULL) && (*do_loop));
}

#ifndef NO_PROBLEM_MAIN
int main(void)
{
    SOLVER((NULL));
    return 0;
}
#endif
