#include <bits/stdc++.h>
using namespace std;
template <class T>
using min_queue = priority_queue<T, vector<T>, greater<T> >;
template <class T>
using max_queue = priority_queue<T>;
template <class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a) {
  return s << "(" << get<0>(a) << ", " << get<1>(a) << ")";
}
template <size_t n, typename... T>
typename std::enable_if<(n >= sizeof...(T))>::type print_tuple(
    std::ostream&, const std::tuple<T...>&) {}
template <size_t n, typename... T>
typename std::enable_if<(n < sizeof...(T))>::type print_tuple(
    std::ostream& os, const std::tuple<T...>& tup) {
  if (n != 0) os << ", ";
  os << std::get<n>(tup);
  print_tuple<n + 1>(os, tup);
}
template <typename... T>
std::ostream& operator<<(std::ostream& os, const std::tuple<T...>& tup) {
  os << "(";
  print_tuple<0>(os, tup);
  return os << ")";
}
template <class T>
ostream& print_collection(ostream& s, T const& a) {
  s << '[';
  for (auto it = begin(a); it != end(a); ++it) {
    s << *it;
    if (it != prev(end(a))) s << ", ";
  }
  return s << ']';
}
template <class T, class U>
ostream& operator<<(ostream& s, map<T, U> const& a) {
  return print_collection(s, a);
}
template <class T>
ostream& operator<<(ostream& s, set<T> const& a) {
  return print_collection(s, a);
}
template <class T>
ostream& operator<<(ostream& s, vector<T> const& a) {
  return print_collection(s, a);
}
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = acos(-1.0), eps = 1e-7;
const int max3 = 510, max4 = 20100, max5 = 201000, max6 = 1000100,
          inf = 0x3f3f3f3f;
const long long mod = 998244353ll;
long long a[max6];
long long sum[max6];
long long dp[max6];
long long p2[max6];
void init() {
  p2[0] = 1;
  for (int i = 1; i < max6; i++) {
    p2[i] = p2[i - 1] * 2 % mod;
  }
}
int main() {
  init();
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  sum[0] = 0;
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + a[i];
    sum[i] %= mod;
  }
  dp[0] = 0;
  long long tmp = 0;
  for (int i = 1; i <= n; i++) {
    if (i == 1) {
      tmp += a[1];
    } else if (i == 2) {
      tmp += a[2];
    } else {
      tmp = (tmp - a[i - 1]) * 2 % mod + a[i - 1] + a[i];
      tmp %= mod;
      tmp = (tmp + mod) % mod;
    }
    dp[i] = dp[i - 1] * 2 % mod + tmp;
    dp[i] %= mod;
  }
  printf("%lld\n", dp[n]);
  return 0;
}
