Sequence (Easy)
InterviewTime limit1sMemory limit512 MB
Given a sequence of positive integers, sum A_i times A_j over every pair i < j and print the result modulo 1,000,000,007.
- Level
Easy3 of 10
- Topics
- Math, Prefix sum, Array, Combinatorics
- Solved
- No attempts yet
Problem
A sequence of length is given, and every element is a positive integer. Find the remainder when the sum of over all integer pairs with is divided by .
Input
The first line gives the length of the sequence .
The second line gives the sequence , separated by spaces.
Output
Print the remainder when the sum of over all integer pairs with is divided by .
Constraints
- ()