#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const double EPS = 1e-9;
int n;
int x;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int s, d;
    scanf("%d%d", &s, &d);
    if (s > x)
      x = s;
    else
      x = x - ((x - s) % d) + d;
  }
  cout << x;
  return 0;
}
