#include #include #include #include #include #include #include #include #include #include #include "testlib.h" using namespace std; #define MOD 998244353 long long modinv(long long a, long long mod) { long long b = mod, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= mod; if (u < 0) u += mod; return u; } int main() { long long N = inf.readLong((long long)1, (long long)1000000); inf.readEoln(); vector A(N); A[0] = inf.readLong((long long)1, (long long)1000000); for (int i = 1; i < N; i++) { inf.readSpace(); A[i] = inf.readLong((long long)1, (long long)1000000); } inf.readEoln(); inf.readEof(); for (int i = 0; i < N - 1; i++) { if (A[i] >= A[i + 1]) cout << -1 << endl; } long long sum = 0; for (long long i = 0; i < N; i++) { long long mul = modinv(A[i], MOD); for (long long j = 0; j < N; j++) { if (i == j) continue; mul = mul * modinv(abs(A[j] * A[j] - A[i] * A[i]) % MOD, MOD) % MOD; } if (i % 2 == 1) mul = MOD - mul; sum += mul; } cout << sum % MOD << endl; }