#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int lcm(int x, int y) { return x / gcd(x, y) * y; }
int lowbit(int x) { return x & (-x); }
int quickmod(int x, int y, int mod) {
  x = x % mod;
  int ans = 1;
  while (y) {
    if (y & 1) ans = 1LL * ans * x % mod;
    y >>= 1;
    x = 1LL * x * x % mod;
  }
  return ans;
}
const int INF = 0x3f3f3f3f;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int MOD = 1e9 + 7;
int n;
int used[2000005];
int main() {
  while (scanf("%d", &n) != EOF) {
    memset(used, 0, sizeof(used));
    int last = 0;
    for (int i = 1; i <= n; i++) {
      int temp1, temp2;
      scanf("%d%d", &temp1, &temp2);
      if (i == 1) {
        last = temp1;
        used[temp1] = 1;
        continue;
      }
      while (temp1 <= last) {
        temp1 += temp2;
      }
      used[temp1] = 1;
      last = temp1;
    }
    printf("%d\n", last);
  }
  return 0;
}
