#include using namespace std; template class modint{ private: long long a; public: constexpr modint(const long long x = 0) noexcept : a((x%mod+mod)%mod) {} constexpr long long& value() noexcept { return a; } constexpr const long long& value() const noexcept { return a; } constexpr modint operator+(const modint rhs) const noexcept { return modint(*this) += rhs; } constexpr modint operator-(const modint rhs) const noexcept { return modint(*this) -= rhs; } constexpr modint operator*(const modint rhs) const noexcept { return modint(*this) *= rhs; } constexpr modint operator/(const modint rhs) const noexcept { return modint(*this) /= rhs; } constexpr modint& operator+=(const modint rhs) noexcept { a += rhs.a; if(a >= mod) a -= mod; return *this; } constexpr modint &operator-=(const modint rhs) noexcept { if(a < rhs.a) a += mod; a -= rhs.a; return *this; } constexpr modint& operator*=(const modint rhs) noexcept { a = a*rhs.a%mod; return *this; } constexpr modint& operator/=(modint rhs) noexcept { long long k = mod-2; while(k > 0){ if(k&1){ *this *= rhs; } rhs *= rhs; k /= 2; } return *this; } friend std::ostream& operator<<(std::ostream &os, const modint &X){ return os << X.a; } friend std::istream& operator>>(std::istream &is, modint &X){ is >> X.a; X.a %= mod; if(X.a < 0) X.a += mod; return is; } }; template T power(T x, long long k){ T ret{1}; while(k > 0){ if(k&1) ret *= x; x *= x; k /= 2; } return ret; } int main(){ using mint = modint<998244353>; int n; cin >> n; mint ans = 0, t = power(2,n-2); for(int i = 0; i < n; ++i){ long long a; cin >> a; ans += t*(i+2)*a; } cout << ans << endl; }