#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:167772160000")
template <typename T>
using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <typename T>
using max_heap = std::priority_queue<T, std::vector<T>, std::less<T>>;
using namespace std;
long long a[1000000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long d = 1;
  long long add = 1;
  for (int i = (0); i < (n); i++) {
    cin >> a[i];
  }
  long long M = 998244353;
  long long ans = 0;
  for (int i = (n - 1); i >= (0); i--) {
    long long delta = (a[i] * d) % M;
    ans = (ans + delta) % M;
    d = (2 * d + add) % M;
    add = (2 * add) % M;
  }
  cout << ans;
  return 0;
}
