#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
struct node {
  int s, d;
} a[300010];
int n;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i].s >> a[i].d;
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i].s > ans) {
      ans = a[i].s;
    } else {
      int dd = ans - a[i].s;
      ans = a[i].s + ((dd / a[i].d) + 1) * a[i].d;
    }
  }
  cout << ans << "\n";
  return 0;
}
