#include <bits/stdc++.h>
using namespace std;
const int MOD1 = 1e9 + 7;
using ll = long long;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll ceildiv(ll a, ll b){return 1LL * (a + b - 1) / b;}
ll n, x;
const int N = 1e5 + 5;
struct minion { ll a, h; };
minion a[N];
void Input() {
cin >> n >> x;
for(int i = 0; i < n; i++)
cin >> a[i].a >> a[i].h,
a[i].h = ceildiv(a[i].h, x);
}
void Solve() {
sort(a, a + n, [&](minion a, minion b){ return a.a * b.h > a.h * b.a; });
ll curr = 0;
ll res = 0;
for(int i = 0; i < n; i++) {
curr += a[i].h;
curr %= MOD1;
res += curr * a[i].a;
res %= MOD1;
}
cout << (res + 1) % MOD1 << "\n";
}
int main()
{
optimize();
Input();
Solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgTU9EMSA9IDFlOSArIDc7CnVzaW5nIGxsICA9ICBsb25nIGxvbmc7CiNkZWZpbmUgb3B0aW1pemUoKSAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApO2Npbi50aWUoMCk7Y291dC50aWUoMCk7CgpsbCBjZWlsZGl2KGxsIGEsIGxsIGIpe3JldHVybiAxTEwgKiAoYSArIGIgLSAxKSAvIGI7fQoKbGwgbiwgeDsKY29uc3QgaW50IE4gPSAxZTUgKyA1OwpzdHJ1Y3QgbWluaW9uIHsgbGwgYSwgaDsgfTsKbWluaW9uIGFbTl07Cgp2b2lkIElucHV0KCkgewogICAgY2luID4+IG4gPj4geDsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspCiAgICAgICAgY2luID4+IGFbaV0uYSA+PiBhW2ldLmgsCiAgICAgICAgYVtpXS5oID0gY2VpbGRpdihhW2ldLmgsIHgpOwp9Cgp2b2lkIFNvbHZlKCkgewogICAgc29ydChhLCBhICsgbiwgWyZdKG1pbmlvbiBhLCBtaW5pb24gYil7IHJldHVybiBhLmEgKiBiLmggPiBhLmggKiBiLmE7IH0pOwogICAgbGwgY3VyciA9IDA7CiAgICBsbCByZXMgPSAwOwogICAgZm9yKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGN1cnIgKz0gYVtpXS5oOwogICAgICAgIGN1cnIgJT0gTU9EMTsKICAgICAgICByZXMgKz0gY3VyciAqIGFbaV0uYTsKICAgICAgICByZXMgJT0gTU9EMTsKICAgIH0KICAgIGNvdXQgPDwgKHJlcyArIDEpICUgTU9EMSA8PCAiXG4iOwp9CgppbnQgbWFpbigpCnsKICAgIG9wdGltaXplKCk7CiAgICBJbnB1dCgpOwogICAgU29sdmUoKTsKICAgIHJldHVybiAwOwp9Cg==