#include <bits/stdc++.h>
int cmpll(const void *x, const void *y) {
  return *(long long *)x - *(long long *)y;
}
long long a[200000], b[200000], sorta[200000], sortb[200000];
int binarySearchA(int key, int num) {
  int ok = -1, ng = num, mid;
  while (ng - ok > 1) {
    mid = (ng + ok) / 2;
    if (sorta[mid] <= key)
      ok = mid;
    else
      ng = mid;
  }
  return ok;
}
int binarySearchB(int key, int num) {
  int ok = -1, ng = num, mid;
  while (ng - ok > 1) {
    mid = (ng + ok) / 2;
    if (sortb[mid] <= key)
      ok = mid;
    else
      ng = mid;
  }
  return ok;
}
int main() {
  int n;
  long long ans = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld", &a[i], &b[i]);
    sorta[i] = a[i];
    sortb[i] = b[i];
  }
  qsort(sorta, n, sizeof(long long), cmpll);
  qsort(sortb, n, sizeof(long long), cmpll);
  for (int i = 0; i < n; i++) {
    int hate = 0;
    int rab = ceil(sqrt(a[i] * b[i]));
    for (int j = -rab; j <= rab; j++) {
      if (j == 0) continue;
      if (a[i] * b[i] % j == 0) {
        if (sorta[binarySearchA(j, n)] == j &&
            sortb[binarySearchB(a[i] * b[i] / j, n)] == a[i] * b[i] / j) {
          hate++;
        }
      }
    }
    ans += n - hate;
    ans %= 1000000007;
  }
  printf("%lld\n", ans);
  return 0;
}
