#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 3e5 + 10;
ll n, a[N], c[N];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i] >> c[i];
}
ll mx = 0, day = 0, sum = 0;
for (int i = 1; i <= n; i++) {
mx = max(mx, a[i]);
if (sum < c[i]) {
ll t = (c[i] - sum + mx - 1) / mx;
day += t;
sum = sum + t * mx - c[i];
} else {
sum = sum - c[i];
}
}
cout << day << endl;
return 0;
}