#include <bits/stdc++.h>

using namespace std;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

ll solve(ll N, ll M) {
    const int mod = 1e9 + 7;
    if (N == 1) {
        return (M + 1) % mod;
    }
    N--, M++;
    ll k1 = ((M % N) % mod) * ((M / N) % mod + 1) % mod;
    ll c1 = ((M / N) % mod + 1) % mod;
    ll k2 = (M % mod + mod - k1) % mod;
    ll c2 = (c1 + mod - 1) % mod;
    return (k1 * c1 % mod + k2 * c2 % mod) % mod;
}

void solve() {
    ll N, M;
    cin >> N >> M;
    cout << solve(N, M) << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

### Prompt

Develop a solution in CPP 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 all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

ll solve(ll N, ll M) {
    const int mod = 1e9 + 7;
    if (N == 1) {
        return (M + 1) % mod;
    }
    N--, M++;
    ll k1 = ((M % N) % mod) * ((M / N) % mod + 1) % mod;
    ll c1 = ((M / N) % mod + 1) % mod;
    ll k2 = (M % mod + mod - k1) % mod;
    ll c2 = (c1 + mod - 1) % mod;
    return (k1 * c1 % mod + k2 * c2 % mod) % mod;
}

void solve() {
    ll N, M;
    cin >> N >> M;
    cout << solve(N, M) << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

```