#include <stdio.h> #include <stdint.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> typedef uint64_t ull; typedef int64_t ll; #ifdef __cplusplus #include <vector> using std::vector; using std::pair; #include <set> using std::set; #include <map> using std::map; typedef pair<ll, ll> P; #endif static const ll MOD = 1000000007LL; static const ll FOD = 998244353LL; ll n, k, m, q; ll h, w, r; char s[2019100]; ll a[201910], b[201910], c[201910]; ll qx[201910], qy[201910]; ll smin (ll a, ll b) { return (a < b) ? a : b; } ll smax (ll a, ll b) { return (a > b) ? a : b; } typedef struct { ll a; ll b; } hwll; int cmp (const void *left, const void *right) { ll l = *(ll*)left, r = *(ll*)right; if (l < r) return -1; if (l > r) return +1; return 0; } ll frac[5050505], invf[5050505]; ll bpow (ll x, ll y) { if (y == 0) return 1; return bpow(x * x % MOD, y / 2) * ((y % 2) ? x : 1) % MOD; } ll binv (ll x) { return bpow(x, MOD - 2); } ull solve () { ll i, j, ki; ull res = 0; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { res += ((a[i] + a[j]) % FOD); } } return res; } int main(void){ scanf("%lld", &n); for (int i = 0; i < n; i++) { scanf("%lld", &a[i]); } printf("%llu\n", solve()); return 0; }