title: Sum of numbers from 0 to 10^18 with modulus 10^9+7
body: <p>How to find sum of numbers from 0 to n modulus 10<sup>9</sup> + 7, where n &le; 10<sup>18</sup>?</p>
  
  <p>I want to store the result in long long int only and not in array or string.
  My code results in a run time error.</p>
  
  <pre><code>const unsigned int m = 1000000007;
  
  long long int n;
  cin &gt;&gt; n;
  long long int s = 0;
  for (long long int i = 0; i &lt; n; i++) {
      s = ((s % m) + (i % m)) % m;
  }
  cout &lt;&lt; s &lt;&lt; endl;
  </code></pre>