#include #include #include using mint=atcoder::modint998244353; void operator+=(std::tuple &l,std::tuple r){ std::get<0>(l)+=std::get<0>(r); std::get<1>(l)+=std::get<1>(r); std::get<2>(l)+=std::get<2>(r); return; } std::tuple operator*(std::tuple l,mint r){ std::get<0>(l)*=r; std::get<1>(l)*=r; std::get<2>(l)*=r; return l; } void print(std::tuple x){ std::cout << std::get<0>(x).val() << ' ' << std::get<1>(x).val() << ' ' << std::get<2>(x).val() << '\n'; } int main(){ int n; std::cin >> n; int a[n+1]; for(int i=1;i<=n;i++)std::cin >> a[i]; assert(1<=n && n<=100000); for(int i=1;i<=n;i++)assert(1<=a[i] && a[i]<=1000000); std::tuple res; std::tuple ans[n+1]; for(int j=1;j<=n;j++){ if(j==1)ans[j]={0,0,mint(1)/6}; else if(j==2)ans[j]={1,-mint(1)/2,0}; else{ ans[j]={0,-1/mint(2).pow(j-1)/(j-1),0}; ans[j]+=ans[j-2]*(mint(j-2)/mint(j-1)); } res+=ans[j]*(a[j]*mint(2).pow(j)); } print(res); }