#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7, INF = INT_MAX;
vector<string> v;
struct vruch {
  int day, per;
} a[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d", &a[i].day, &a[i].per);
  }
  int ans = a[1].day;
  for (int i = 2; i <= n; ++i) {
    int nomdn = ans, kogdasmzh = a[i].day;
    while (kogdasmzh <= nomdn) {
      kogdasmzh += a[i].per;
    }
    ans = kogdasmzh;
  }
  printf("%d\n", ans);
  return 0;
}
