#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9) + 33;
const int MAXN = int(1e5);
int n, m, k;
int a[MAXN], b[MAXN + 10];
string s;
double d;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  int pre = 0;
  for (int i = 0; i < (n); i++) {
    int s, d;
    cin >> s >> d;
    while (s <= pre) s += d;
    pre = s;
  }
  cout << pre << endl;
  return 0;
}
