#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;

vector <pair <int, int> > a;
vector <int> ost;
priority_queue <pair <int, int> > h;

int main() {
	freopen("castle.in", "r", stdin);
	freopen("castle.out", "w", stdout);
	int n, s, b, c;
	scanf_s("%d%d", &n, &s);
	for (int i = 0; i < n; i++) {
		scanf_s("%d%d", &b, &c);
		a.push_back(make_pair(c, b));
		h.push(make_pair(c, b));
	}

	int cur = 0;
	while (cur < s && !h.empty()) {
		b = h.top().second;
		c = h.top().first;
		h.pop();
		if (b / c + cur <= s) {
			if (b % c != 0) {
				h.push(make_pair((b % c), b % c));
			}
			cur += b / c;
		}
		else {
			h.push(make_pair(c, b - ((s - cur) * c)));
			cur = s;
		}
	}

	long long ans = 0;
	while (!h.empty()) {
		ans += h.top().second;
		h.pop();
	}

	cout << ans;
	
	return 0;
}
/*
3 3
4 2
1 1
10 8
*/