#include <bits/stdc++.h>
const int N = 100007, inf = 0x3f3f3f3f;
using namespace std;
pair<int, int> v[N];
int bb(int cur, int p) {
  int l = 0, r = cur;
  while (l < r) {
    int m = (l + r) / 2;
    if (v[p].first + v[p].second * m > cur)
      r = m;
    else
      l = m + 1;
  }
  return v[p].first + v[p].second * l;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int s, f;
    cin >> s >> f;
    v[i] = make_pair(s, f);
  }
  int cur = 0;
  for (int i = 0; i < n; ++i) {
    cur = bb(cur, i);
  }
  cout << cur << endl;
}
