#include <bits/stdc++.h>
using namespace std;
uint64_t a[1000001];
int main(int argc, char *argv[]) {
  uint64_t n;
  scanf("%" SCNu64, &n);
  for (uint64_t i = 1; i <= n; i++) {
    scanf("%" SCNu64, &a[i]);
  }
  uint64_t pow_of_two = 1;
  uint64_t sum = a[n];
  for (uint64_t k = n - 1; k >= 1; k--) {
    uint64_t item = (n - k + 2) * a[k];
    item %= (998244353);
    item *= pow_of_two;
    item %= (998244353);
    sum += item;
    sum = sum % (998244353);
    pow_of_two = pow_of_two * 2 % (998244353);
  }
  cout << sum % (998244353) << endl;
  return 0;
}
