#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> sd[1001];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> sd[i].first >> sd[i].second;
  }
  long int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (sd[i].first > ans) {
      ans = sd[i].first;
    } else {
      for (int j = sd[i].first + sd[i].second;; j += sd[i].second) {
        if (j > ans) {
          ans = j;
          break;
        }
      }
    }
  }
  cout << ans;
}
