Finding sum

4.4

16 votes
Multiplicative inverse, Number Theory, Data Structures, Multiplicative Inverse, Modulo arithmetic, Math
Problem

You are given an array a1, a2, ..., an of size N and the following expression:

Find the value of the provided expression modulus 1000000007.

Input format

  • The first line contains an integer N denoting the number of elements in array a.
  • The second line contains N space-separated integers denoting the elements of a.

Output format

Find the value of the above expression modulus 1000000007.

Constraints
2N1051a[i]106

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

The expansion of the given expression for this array is:
12+23+34=20

Editor Image

?