#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;

  ll a = 1, b = 1;

  for (int i = 0; i < n; ++i) {
    ll x, y;
    cin >> x >> y;

    ll c1 = (a + x - 1) / x;
    ll c2 = (b + y - 1) / y;
    ll c = max(c1, c2);
    a = x * c;
    b = y * c;
  }

  cout << a + b << endl;
}
