#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
constexpr ll MOD = 1000000007;
//---------------------------------//

ll mod_pow(ll x, ll n, ll mod = MOD) {
	if (n == 0) return 1;
	ll res = mod_pow(x * x % mod, n / 2, mod);
	if (n & 1) res = res * x % mod;
	return res;
}


int main() {
	ll N, M;
	cin >> N >> M;
	
	ll ans = 0;
	
	if (N == 1) {
		ans = (M + 1) % MOD;
		cout << ans << endl;
		return 0;
	}
	
	// d \geq 0
	// 0 \leq a_1leq m - (n - 1)d
	ll pat = M / (N - 1) % MOD;
	(ans += (M % (N - 1) + 1) % MOD * (pat + 1) % MOD) %= MOD;
	(ans += (N - 1) % MOD * (1 + pat) % MOD * pat % MOD * mod_pow(2, MOD - 2) % MOD) %= MOD;
	

	
	// d < 0
	// (n - 1)l \leq a_1 \leq m
	// 0 \leq a_1 \leq m - (n - 1)l
	
	M -= N - 1;
	if (M < 0) {
		cout << ans << endl;
		return 0;
	}
	
	pat = M / (N - 1) % MOD;
	(ans += (M % (N - 1) + 1) % MOD * (pat + 1) % MOD) %= MOD;
	(ans += (N - 1) % MOD * (1 + pat) % MOD * pat % MOD * mod_pow(2, MOD - 2) % MOD) %= MOD;
	
	cout << ans << endl;
	
	return 0;
}


### Prompt

Generate a cpp solution to the following problem:

B: Ebi-chan and Integer Sequences-

problem

Ebi-chan likes sequences. I especially like arithmetic progressions. This time, I decided to create a sequence that meets the following conditions.

* Arithmetic progression of length n
* When the i-th element of the sequence is defined as s_i, all s_i (1 \ leq i \ leq n) are integers that satisfy 0 \ leq s_i \ leq m.



How many sequences are there that satisfy the above conditions? However, the answer can be very large, so print the remainder after dividing by 10 ^ 9 + 7.

Input format

Input is given in one line.


n m

n represents the length of the sequence.

Constraint

* 1 \ leq n \ leq 10 ^ {15}
* 0 \ leq m \ leq 10 ^ {15}



Output format

Divide the number of arithmetic progressions that satisfy the condition by 10 ^ 9 + 7 and output the remainder in one row.

Input example 1


3 9

Output example 1


50

Input example 2


10000000000 10000000000

Output example 2


999999942

Note that the input does not fit in a 32-bit integer.





Example

Input

3 9


Output

50

### Response

```cpp
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
constexpr ll MOD = 1000000007;
//---------------------------------//

ll mod_pow(ll x, ll n, ll mod = MOD) {
	if (n == 0) return 1;
	ll res = mod_pow(x * x % mod, n / 2, mod);
	if (n & 1) res = res * x % mod;
	return res;
}


int main() {
	ll N, M;
	cin >> N >> M;
	
	ll ans = 0;
	
	if (N == 1) {
		ans = (M + 1) % MOD;
		cout << ans << endl;
		return 0;
	}
	
	// d \geq 0
	// 0 \leq a_1leq m - (n - 1)d
	ll pat = M / (N - 1) % MOD;
	(ans += (M % (N - 1) + 1) % MOD * (pat + 1) % MOD) %= MOD;
	(ans += (N - 1) % MOD * (1 + pat) % MOD * pat % MOD * mod_pow(2, MOD - 2) % MOD) %= MOD;
	

	
	// d < 0
	// (n - 1)l \leq a_1 \leq m
	// 0 \leq a_1 \leq m - (n - 1)l
	
	M -= N - 1;
	if (M < 0) {
		cout << ans << endl;
		return 0;
	}
	
	pat = M / (N - 1) % MOD;
	(ans += (M % (N - 1) + 1) % MOD * (pat + 1) % MOD) %= MOD;
	(ans += (N - 1) % MOD * (1 + pat) % MOD * pat % MOD * mod_pow(2, MOD - 2) % MOD) %= MOD;
	
	cout << ans << endl;
	
	return 0;
}


```