#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& arr) {
  for (auto& i : arr) {
    in >> i;
  }
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> arr) {
  for (int64_t i = 0; i < (int64_t)arr.size() - 1; ++i) out << arr[i] << " ";
  if (arr.size()) out << arr.back();
  out << '\n';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, set<T>& s) {
  for (auto x : s) out << x << " ";
  out << '\n';
  return out;
}
const int64_t mod = 998244353;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int64_t n;
  cin >> n;
  vector<int64_t> arr(n);
  vector<int64_t> arr2(n);
  cin >> arr2;
  arr[0] = 1;
  arr[1] = 3;
  int64_t a = 1;
  int64_t ans = 0;
  for (int64_t i = 2; i < n; ++i) {
    arr[i] = (arr[i - 1] + a) * 2;
    arr[i] = (arr[i] >= mod ? arr[i] - mod : arr[i]);
    arr[i] = (arr[i] >= mod ? arr[i] - mod : arr[i]);
    arr[i] = (arr[i] >= mod ? arr[i] - mod : arr[i]);
    arr[i] = (arr[i] >= mod ? arr[i] - mod : arr[i]);
    a *= 2;
    a = (a >= mod ? a - mod : a);
  }
  reverse(arr.begin(), arr.end());
  for (int64_t i = 0; i < n; ++i) {
    ans += arr2[i] * arr[i];
    ans %= mod;
  }
  cout << ans << '\n';
  return 0;
}
