#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int mod = 1e9 + 7;
int p[100005];
bool vis[100005];
vector<long long> v;
int main() {
  int n;
  scanf("%d", &n);
  int now = 0;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (x > now) {
      now = x;
    } else {
      now = x + y * ((now - x) / y + 1);
    }
  }
  printf("%d\n", now);
  return 0;
}
