#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int x, y;
  int m = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    if (x > m) {
      m = x;
    } else {
      while (m >= x) {
        x = y + x;
      }
      m = x;
    }
  }
  printf("%d\n", m);
}
