Amplitude Hackathon '23 Practice Problem 1 - Gigatron EPS Modulo 998244353

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type

Kurt's favorite prime number is 998244353. Over the course of N seconds where he knows how many events Gigatron processed each second, he wants to know the total number of events Gigatron processed, modulo 998244353.

Constraints

1N106

0ai109

Input Specification

The first line of input contains a single positive integer N.

The second line contains N nonnegative integers, ai, representing the number of events Gigatron processed during second i.

Output Specification

Let T be the total number of events Gigatron processed over the N seconds. Compute the remainder when T is divided by 998244353.

Sample Input

Copy
3
1000000000 1000000000 994733059

Sample Output

Copy
0

Sample Explanation

We can see that Gigatron processed 2994733059 events. Note that 2994733059=3×998244353, so the remainder when 2994733059 is divided by 998244353 is zero.


Comments

There are no comments at the moment.