#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep1(i, n) for(int i=1; i<=(int)(n); i++)
#define rep2(i, n, m) for(int i=(int)n; i<=(int)m; i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> wi;
typedef vector<ll> vl;
const ll inf=1LL<<60;

template<ll m> struct ModInt{
  ll val;

  constexpr ModInt(ll v=0) noexcept : val(v%m){
    if(val<0)val+=m;
  }

  constexpr ll getmod(){return m;}

  constexpr ModInt operator - () const noexcept{
    return val ? m-val : 0;
  }

  constexpr ModInt operator + (const ModInt& r)const noexcept{return ModInt(*this) += r;}

  constexpr ModInt operator - (const ModInt& r)const noexcept{return ModInt(*this) -= r;}

  constexpr ModInt operator * (const ModInt& r)const noexcept{return ModInt(*this) *= r;}

  constexpr ModInt operator / (const ModInt& r)const noexcept{return ModInt(*this) /= r;}

  constexpr ModInt& operator += (const ModInt& r)noexcept{
    val+=r.val;
    if(val>=m)val-=m;
    return *this;
  }

  constexpr ModInt& operator -= (const ModInt& r)noexcept{
    val-=r.val;
    if(val<0)val+=m;
    return *this;
  }

  constexpr ModInt& operator *= (const ModInt& r)noexcept{
    val=val*r.val%m;
    return *this;
  }

  constexpr ModInt& operator /= (const ModInt& r)noexcept{
    ll a=r.val, b=m, u=1, v=0;
    while(b){
      ll t=a/b;
      a-=t*b;swap(a, b);
      u-=t*v;swap(u, v);
    }
    val=val*u%m;
    if(val<0)val+=m;
    return *this;
  }

  constexpr bool operator == (const ModInt& r)const noexcept{
    return this->val == r.val;
  }

  constexpr bool operator != (const ModInt& r)const noexcept{
    return this->val != r.val;
  }

  friend constexpr ostream& operator << (ostream &os, const ModInt<m>& x)noexcept{
    return os << x.val;
  }

  friend constexpr istream& operator >> (istream &is, ModInt &x){
    is >> x.val;
    x=ModInt(x.val);
    return is;
  }

  friend constexpr ModInt<m> modpow(const ModInt<m> &a, ll n)noexcept{
    if(n==0)return 1;
    auto t=modpow(a, n/2);
    t=t*t;
    if(n&1)t=t*a;
    return t;
  }

  friend constexpr ModInt<m> modinv(const ModInt<m> &a)noexcept{
    ll b=m, u=1, v=0;
    while(b){
      ll t=a/b;
      a-=t*b;swap(a, b);
      u-=t*v;swap(u, v);
    }
    u%=m;
    if(u<0)u+=m;
    return u;
  }
};

const ll mod1=1000000007;
const ll mod9=998244353;

using mint = ModInt<mod9>;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  mint a, b, c;
  cin >> a >> b >> c;

  cout << (a*(a+1)*b*(b+1)*c*(c+1))/8 << endl;

  return 0;
}
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<int, int> pii;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = a; i <= (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b); i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)

#define sz(x) (int)(x).size()
#define popcnt(x) __builtin_popcount(x)
#define low_bo(a, x) (lower_bound(a.begin(), a.end(), x) - a.begin())
#define up_bo(a, x) (upper_bound(a.begin(), a.end(), x) - a.begin())
#define unique(a) a.resize(unique(a.begin(), a.end()) - a.begin())
#define shuffle(a) shuffle(a.begin(), a.end(), rnd)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 998244353;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
ll p[MX];
void init() {
  p[0]=1;
  for(int i=1; i<MX; i++) {
    p[i]=(p[i-1]*2)%MOD;
  }
}
void solve(int t) {
  int n;
  cin>>n;
  vl arr(n);
  F0R(i,n) {
    cin>>arr[i];
  }
  sort(all(arr));
  ll ret=0;
  ll sm[2][n];
  sm[0][0]=0;
  sm[1][0]=0;
  for(int i=1; i<n; i++) {
    sm[0][i]=((sm[0][i-1]*2+arr[i-1])%MOD)%MOD;
    // sm[1][i]=(sm[1][i-1]+(arr[i]*pow[i-1])%MOD)%MOD;
  }
  // F0R(i,n) {
  //   cout << sm[0][i]<<nl;
  // }
  F0R(i,n) {
    ret=(ret+(arr[i]*(sm[0][i]+arr[i]))%MOD)%MOD;
    // cout << ret <<nl;
  }
  cout << ret <<nl;
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(20);
  cout << fixed;
  init();
  int T = 1;
  F0R(i,T) {
    solve(i+1);
  }
}

// read the question correctly (ll vs int)
// template by bqi343