Regarding range queries

Hi all! So lets assume we have a sequence of length N and we are given the number of queries as Q. For each Q, we are given two indices - L and R. Also, let there be F as some commutative function(like addition, subtraction, product etc.) For each query, we have to compute F(seq[L] x 1, seq[L+1] x 2 , seq[L+3] x 3, … , seq[R] x (R-L+1)). (Edit: x denotes multiplication)

I was thinking to use segment trees but it seems there may be a different way. How do you guys recommend approaching the problem?

Thanks!

Edit: Found a similar problem here