#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  int last = -1;
  for (int i = 0; i < n; ++i) {
    int s, d;
    cin >> s >> d;
    if (i == 0) {
      ans = s, last = s;
    } else {
      int now = s;
      while (now <= last) now += d;
      last = now;
      ans += (now - ans);
    }
  }
  cout << ans << endl;
}
