**Problem Statement:**↵
↵
Given an integer $n$, calculate the sum of all integers from $1$ to $n$ where each term adds the first $k$ integers for $k$ from $1$ to $n$. Output the result modulo $10^9 + 7$.↵
n $, find the sum of $ f(k) $, where $ f(k) = 1 + 2 + 3 + \ldots + k $ and $ 1 <= k <= n $ . Output the result modulo $ 10^9 + 7 $. max(n) = $10^9$.↵
↵
**MY approach:** ↵
Firstly , very very sorry for my poor english.↵
My approach was to use the formula n(n + 1)/2 in a loop. But I am getting TLE every time. But I don't know how to fix it any further. I first I used 2 nested loops and then only one loop. But not working. ↵
↵
Can some generous person help me?
Given an integer $
↵
**MY approach:** ↵
Firstly , very very sorry for my poor english.↵
My approach was to use the formula n(n + 1)/2 in a loop. But I am getting TLE every time. But I don't know how to fix it any further. I first I used 2 nested loops and then only one loop. But not working. ↵
↵
Can some generous person help me?