MOD = 998244353 n = int(input()) a = list(map(int, input().split())) result = 0 for k in range(n): ak = a[k] ak_sq = (ak * ak) % MOD product = 1 for i in range(n): if i == k: continue ai_sq = (a[i] * a[i]) % MOD term = (ai_sq - ak_sq) % MOD product = (product * term) % MOD # Compute inverse of product inv_product = pow(product, MOD - 2, MOD) # Compute inverse of ak inv_ak = pow(ak, MOD - 2, MOD) # Add term to result term = (inv_ak * inv_product) % MOD result = (result + term) % MOD print(result)