Pera in CSEmpur

Who does not like a short and precise problem statement? Atleast everyone in CSEmpur does.

You are given an array A consisting of positive integers. The pera of a subarray is defined as the sum of the elements of the subarray. You have to process Q queries. In each query you will be given two integers L and R. You have to print the sum of the pera of all possible subarrays of A in the interval [L, R]. Print the answer modulo 109+7.

This is a companion discussion topic for the original entry at