#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define reep(i,a,b) for(int i=a; i<b; i++)
#define MOD 1000000007
#define INFL 0x3f3f3f3f3f3f3f3f

using ll = long long;

// Mod int
// const int MOD = 1000000007;
struct mint{
    ll x;
    mint():x(0){}
    mint(ll x):x((x%MOD+MOD)%MOD){}
    mint operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
    mint operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
    mint operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
    mint operator+(const mint& a)const{ return mint(*this) += a;}
    mint operator-(const mint& a)const{ return mint(*this) -= a;}
    mint operator*(const mint& a)const{ return mint(*this) *= a;}
    bool operator==(const mint& a)const{ return x == a.x;}
    friend ostream& operator<<(ostream& os, const mint& mi)  
    {  
        os << mi.x;  
        return os;  
    }
};



int main(){
	ll n,m;
	cin>>n>>m;
	ll l = 0;
	ll r = INFL/n + 500;
	if(n==1){
		cout<<(m+1)%MOD<<endl;
		return 0;
	}
	while(r-l>1){
		ll mid = (r+l)/2;
		ll val = m-(n-1)*mid;
		if(val < 0) r = mid;
		else l = mid;
	}
	mint ans;
	l %= MOD;
	ans = mint((m+1)%MOD)*mint(l)*mint(2) - mint((n-1)%MOD)*mint(l)*mint(l+1);
	// cout<<ans<<endl;
	// ans *= mint(2);
	ans += mint(m%MOD+1);
	cout<<ans<<endl;
}
### Prompt

Please provide a cpp coded solution to the problem described below:

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 <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define reep(i,a,b) for(int i=a; i<b; i++)
#define MOD 1000000007
#define INFL 0x3f3f3f3f3f3f3f3f

using ll = long long;

// Mod int
// const int MOD = 1000000007;
struct mint{
    ll x;
    mint():x(0){}
    mint(ll x):x((x%MOD+MOD)%MOD){}
    mint operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
    mint operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
    mint operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
    mint operator+(const mint& a)const{ return mint(*this) += a;}
    mint operator-(const mint& a)const{ return mint(*this) -= a;}
    mint operator*(const mint& a)const{ return mint(*this) *= a;}
    bool operator==(const mint& a)const{ return x == a.x;}
    friend ostream& operator<<(ostream& os, const mint& mi)  
    {  
        os << mi.x;  
        return os;  
    }
};



int main(){
	ll n,m;
	cin>>n>>m;
	ll l = 0;
	ll r = INFL/n + 500;
	if(n==1){
		cout<<(m+1)%MOD<<endl;
		return 0;
	}
	while(r-l>1){
		ll mid = (r+l)/2;
		ll val = m-(n-1)*mid;
		if(val < 0) r = mid;
		else l = mid;
	}
	mint ans;
	l %= MOD;
	ans = mint((m+1)%MOD)*mint(l)*mint(2) - mint((n-1)%MOD)*mint(l)*mint(l+1);
	// cout<<ans<<endl;
	// ans *= mint(2);
	ans += mint(m%MOD+1);
	cout<<ans<<endl;
}
```