#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, B, G;
  list *p, *hash[100003] = {}, d[200010];
  scanf("%d", &N);
  for (i = 1; i <= N; i++) {
    scanf("%lld %lld", &A, &B);
    if (A != 0 && B != 0) {
      G = gcd(llabs(A), llabs(B));
      A /= G;
      B /= G;
      if (A < 0) {
        A *= -1;
        B *= -1;
      }
    } else if (A != 0)
      A = 1;
    else if (B != 0)
      B = -1;
    h = (A % 100003 - B % 100003 * 397 + 100003 * 397) % 100003;
    for (p = hash[h]; p != NULL; p = p->next)
      if (p->a == A && p->b == B) break;
    if (p != NULL)
      p->num++;
    else {
      d[i].a = A;
      d[i].b = B;
      d[i].num = 1;
      d[i].next = hash[h];
      hash[h] = &(d[i]);
    }
  }
  long long ans = 1, pow[200010], 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 * 397) %
              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;
}
