#include #include using namespace std; using i32 = int; using u32 = unsigned int; using i64 = long long; using u64 = unsigned long long; #define FAST_IO \ ios::sync_with_stdio(false); \ cin.tie(0); const i64 INF = 1001001001001001001; using Modint = atcoder::static_modint<998244353>; vector> enumFIF(int n) { vector fif(2, vector(n + 1, Modint(0))); fif[0][0] = 1; for (auto i : views::iota(1, n + 1)) { fif[0][i] = fif[0][i - 1] * i; } fif[1][n] = fif[0][n].inv(); for (auto i = n; i > 0; i--) { fif[1][i - 1] = fif[1][i] * i; } return fif; } Modint conv(int n, int r, vector>& fif) { return fif[0][n] * fif[1][r] * fif[1][n - r]; } int main() { FAST_IO int N; cin >> N; vector A(N); for (int i = 0; i < N; i++) { i64 x; cin >> x; A[i] = x; } Modint ans = 0; auto fif = enumFIF(N * 2); for (int i = 0; i < N; i++) { Modint x = conv((N - 1) * 2 - i, N - 1 - i, fif); Modint y = conv((N - 1) * 2 - i, N - 1 - i - 1, fif); ans += A[i] * (x - y); } cout << ans.val() << endl; }