#define consfl 0
#define fname "castle"

#include <iostream>
#include <cstdio>
#include <cstdlib>

#include <algorithm>
#include <cmath>

#include <vector>
#include <set>

#define forn(i, n) for (int i = 0; i < n; i ++)
#define fornn(i, n, m) for (int i = n; i < m; i ++)
#define mk make_pair
#define outb pop_back
#define inb push_back
#define X first
#define Y second

typedef long long ll;

using namespace std;

const int dd = 1e5;


int main(){
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	if (!consfl) {
		freopen(fname".in", "r", stdin);
		freopen(fname".out", "w", stdout);
	}
#endif
	ll n, s;
	cin >> n >> s;
	ll sum = 0;
	set<pair<ll, ll> > qwe;
	forn(i, n){
		ll x, k;
		cin >> x >> k;
		sum += x;
		qwe.insert(mk(k, x));
	}
	while (qwe.size()) {
		sum -= min(qwe.rbegin()->Y / qwe.rbegin()->X, s) * (qwe.rbegin()->X);
		s -= min(qwe.rbegin()->Y / qwe.rbegin()->X, s);
		qwe.insert(mk(qwe.rbegin()->Y % qwe.rbegin()->X, 1));
		qwe.erase(--qwe.end());
		if (!s)
			break;
	}
	cout << sum;
	return 0;
}