#include <bits/stdc++.h>
void swap(int* a, int* b) {
  int tmp = *a;
  *a = *b;
  *b = tmp;
}
int abs(int a) {
  if (a < 0) return -a;
  return a;
}
int dup(int a, int d) {
  if (a % d == 0)
    return a / d;
  else
    return a / d + 1;
}
int mod(int a, int m) {
  if (a < 0)
    return a % m + m;
  else
    return a % m;
}
void swapl(long long* a, long long* b) {
  long long tmp = *a;
  *a = *b;
  *b = tmp;
}
long long absl(long long a) {
  if (a < 0) return -a;
  return a;
}
long long dupl(long long a, long long d) {
  if (a % d == 0)
    return a / d;
  else
    return a / d + 1;
}
long long modl(long long a, long long m) {
  if (a < 0)
    return a % m + m;
  else
    return a % m;
}
long long signl(long long a) { return a == 0 ? 0 : (a > 0 ? 1 : -1); }
long long GCD(long long a, long long b) {
  long long c = 1, tmp = ((a) < (b) ? (b) : (a));
  b = ((a) < (b) ? (a) : (b));
  a = tmp;
  while (c != 0) {
    c = a % b;
    a = b;
    b = c;
  }
  return a;
}
long long LCM(long long a, long long b) { return a * b / GCD(a, b); }
long long factorial(long long n, long long m) {
  return n < m ? 1 : n * factorial(n - 1, m);
}
int upll(const void* a, const void* b) {
  return *(long long*)a < *(long long*)b   ? -1
         : *(long long*)a > *(long long*)b ? 1
                                           : 0;
}
int downll(const void* a, const void* b) {
  return *(long long*)a < *(long long*)b   ? 1
         : *(long long*)a > *(long long*)b ? -1
                                           : 0;
}
void sortup(long long* a, int n) { qsort(a, n, sizeof(long long), upll); }
void sortdown(long long* a, int n) { qsort(a, n, sizeof(long long), downll); }
typedef struct {
  long long a;
  long long b;
} box;
int boxa_cmp(box* a, box* b) {
  return (a->a - b->a != 0) ? (a->a - b->a) : (a->b - b->b);
}
int boxa_downll(const void* a, const void* b) {
  return boxa_cmp((box*)a, (box*)b);
}
long long pow2l(long long n) {
  if (n == 0) {
    return 1;
  }
  return (2 * pow2l(n - 1) % 1000000007);
}
int main() {
  box p[200000];
  box m[200000];
  long long pn = 0, mn = 0, zn0 = 0, zn1 = 0, zn2 = 0, n, k;
  long long a, b, gcdab;
  long long i, j, ans = 0;
  long long u, v;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld%lld", &a, &b);
    if (signl(a) * signl(b) == 0) {
      if (a == 0 && b == 0)
        zn0++;
      else if (a == 0)
        zn1++;
      else
        zn2++;
    } else if (signl(a) * signl(b) > 0) {
      a = absl(a), b = absl(b);
      gcdab = GCD(a, b);
      a /= gcdab;
      b /= gcdab;
      p[pn].a = a;
      p[pn].b = b;
      pn++;
    } else {
      a = absl(a), b = absl(b);
      gcdab = GCD(a, b);
      a /= gcdab;
      b /= gcdab;
      m[mn].a = b;
      m[mn].b = a;
      mn++;
    }
  }
  qsort(p, pn, sizeof(box), boxa_downll);
  qsort(m, mn, sizeof(box), boxa_downll);
  ans = (pow2l(zn1) + pow2l(zn2) - 1) % 1000000007;
  i = j = 0;
  while (i < pn && j < mn) {
    if (boxa_cmp(&p[i], &m[j]) == 0) {
      for (u = 1; i + u < pn; u++)
        if (boxa_cmp(&p[i], &p[i + u]) != 0) break;
      for (v = 1; j + v < mn; v++)
        if (boxa_cmp(&m[j], &m[j + v]) != 0) break;
      k = (1000000007 + pow2l(u) - 1) % 1000000007;
      k = (k + pow2l(v)) % 1000000007;
      ans = ans * k % 1000000007;
      i += u;
      j += v;
    } else {
      ans = (ans * 2) % 1000000007;
      if (boxa_cmp(p + i, m + j) < 0)
        i++;
      else
        j++;
    }
  }
  ans = ans * pow2l(pn - i) % 1000000007;
  ans = ans * pow2l(mn - j) % 1000000007;
  ans = (ans + zn0) % 1000000007;
  ans = (1000000007 + ans - 1) % 1000000007;
  printf("%lld\n", ans);
  return 0;
}
