#include <bits/stdc++.h>
typedef struct List {
  struct List *next;
  long long a, b;
  int num;
} list;
long long gcd(long long a, long long b) {
  if (a > b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  if (b % a == 0)
    return a;
  else
    return gcd(b % a, a);
}
int main() {
  int h, i, N;
  long long A[200001], B[200001], G;
  list *p, *hash[100003] = {}, d[200001];
  scanf("%d", &N);
  for (i = 1; i <= N; i++) {
    scanf("%lld %lld", &(A[i]), &(B[i]));
    if (A[i] == 0 && B[i] == 0)
      ;
    else if (A[i] == 0)
      B[i] = 1;
    else if (B[i] == 0)
      A[i] = 1;
    else {
      G = gcd(llabs(A[i]), llabs(B[i]));
      A[i] /= G;
      B[i] /= G;
      if (A[i] < 0) {
        A[i] *= -1;
        B[i] *= -1;
      }
    }
    h = (A[i] % 100003 + B[i] % 100003 * 397 + 100003) % 100003;
    for (p = hash[h]; p != NULL; p = p->next)
      if (p->a == A[i] && p->b == B[i]) break;
    if (p != NULL)
      p->num++;
    else {
      d[i].a = A[i];
      d[i].b = B[i];
      d[i].num = 1;
      d[i].next = hash[h];
      hash[h] = &(d[i]);
    }
  }
  long long ans = 1, pow[200001], tmp;
  list *q, *r;
  for (i = 1, pow[0] = 1; i <= N; i++) pow[i] = pow[i - 1] * 2 % 1000000007;
  for (h = 0; h < 100003; h++) {
    for (p = hash[h]; p != NULL; p = p->next) {
      if (p->num > 0) {
        if (p->a == 0 && p->b == 0) {
          for (q = hash[1]; q != NULL; q = q->next)
            if (q->b == 0) break;
          for (r = hash[397]; r != NULL; r = r->next)
            if (r->a == 0) break;
          tmp = p->num + 1;
          if (q != NULL) {
            tmp += pow[q->num] - 1;
            q->num = 0;
          }
          if (r != NULL) {
            tmp += pow[r->num] - 1;
            r->num = 0;
          }
          ans = ans * tmp % 1000000007;
        } else {
          tmp = (p->b <= 0) ? p->a : -(p->a);
          i = (llabs(p->b) % 100003 + tmp % 100003 * 397 + 100003) % 100003;
          for (q = hash[i]; q != NULL; q = q->next)
            if (q->a == llabs(p->b) && q->b == tmp) break;
          if (q == NULL)
            ans = ans * pow[p->num] % 1000000007;
          else {
            ans = ans * (pow[p->num] + pow[q->num] - 1) % 1000000007;
            q->num = 0;
          }
        }
      }
    }
  }
  printf("%lld\n", (ans + 1000000007 - 1) % 1000000007);
  fflush(stdout);
  return 0;
}
