import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { var sc = new Scanner(System.in); int n = sc.nextInt(); var a = new int[n]; Arrays.setAll(a , i -> sc.nextInt()); long s = 0; for (int i = 0; i < n; i++) { long t = a[i]; for (int j = 0; j < n; j++) { if (i != j) { t *= (a[j] * a[j] - a[i] * a[i]) % mod; t %= mod; } } if (t < 0) t += mod; s += inv(t); s %= mod; } System.out.println(s); } public static long mod = 998244353; static long inv(long a) { return mp(a, mod - 2); } static long mp(long a, long b) { if (b == 0) return 1; if ((b & 1) == 1) return (a * mp(a, b - 1)) % mod; return mp((a * a) % mod, b >> 1); } }