#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int k = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    k = k * 10 + ch - '0';
    ch = getchar();
  }
  return k * f;
}
int a[10010], b[10010];
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) a[i] = read(), b[i] = read();
  int t = 0;
  for (int i = 1; i <= n; i++) {
    while (a[i] < t) a[i] += b[i];
    if (t == a[i]) a[i] += b[i];
    t = a[i];
  }
  printf("%d", t);
}
