#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c;
  c = 0;
  cin >> a >> b;
  for (int i = b; i <= a + 1; i++) {
    c += a * i - i * (i - 1) + 1;
    if (c > 1000000007) c %= 1000000007;
  }
  cout << c << endl;
}
