#include <bits/stdc++.h>
using namespace std;
int ara[1007][1007];
int visit[1007][1007];
int n, m;
int l[] = {0, 0, 1, -1};
int d[] = {1, -1, 0, 0};
void bfs(int x, int y) {
  memset(visit, -1, sizeof visit);
  queue<pair<int, int> > q;
  q.push({x, y});
  visit[x][y] = 0;
  while (!q.empty()) {
    int u = q.front().first;
    int v = q.front().second;
    q.pop();
    for (int i = 0; i < 4; i++) {
      int xx = u + l[i];
      int yy = v + d[i];
      if (xx > 0 && yy > 0 && xx <= n && yy <= m && ara[xx][yy] == 0 &&
          visit[xx][yy] == -1) {
        visit[xx][yy] = visit[u][v] + 1;
        q.push({xx, yy});
      }
    }
  }
}
int main() {
  scanf("%d", &n);
  vector<pair<int, int> > ab;
  for (int i = 0; i < n; i++) {
    int s, f;
    scanf("%d%d", &s, &f);
    ab.push_back({s, f});
  }
  int j = ab[0].first;
  int counter(0);
  for (int i = 0; i < ab.size(); i++) {
    int u = ab[i].first;
    int v = ab[i].second;
    if (i == 0) {
      continue;
    }
    if (u <= j) {
      for (int k = u;; k += v) {
        if (k > j) {
          j = k;
          break;
        }
      }
    } else if (u > j) {
      j = u;
    }
  }
  printf("%d", j);
  printf("\n");
}
