#include <bits/stdc++.h>

#define int long long

using namespace std;

int32_t main()
{
    ifstream cin("castle.in");
    ofstream cout("castle.out");
    int n, s;
    cin >> n >> s;
    priority_queue<pair<int, int> > arr;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        arr.push(make_pair(b, a));
        ans += a;
    }
    for (int i = 0; i < 2 * n; i++)
    {
        if (arr.empty() || s == 0)
            break;
        auto x = arr.top();
        if (x.second == 0)
            break;
        arr.pop();
        int os = s;
        s -= x.second / x.first;
        if (s < 0)
            s = 0;
        int ds = os - s;
        ans -= ds * x.first;
        int ne = x.second - ds * x.first;
        arr.push(make_pair(ne, ne));
    }
    cout << ans;
    return 0;
}
