import std.algorithm;
import std.format;
import std.stdio;
import std.string;

void main() {
  int n;
  readf(" %s",&n);

  int ct,ca;
  readf(" %s %s", &ct, &ca);
  foreach (i; 1 .. n) {
      int a,t;
      readf(" %s %s", &t, &a);

      int na = (ca + a - 1) / a * a;
      int nt = (ct + t - 1) / t * t;

      int k = max(na/a,nt/t);

      ct = t * k;
      ca = a * k;

      debug {
          writeln(ct,",",ca);
      }
  }

  writeln(ct+ca);
}
