#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 3e5 + 10;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  while (n--) {
    int x, d;
    cin >> x >> d;
    while (ans >= x) x += d;
    ans = x;
  }
  cout << ans << endl;
  return 0;
}
