#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long power(long long k, long long n, int M) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * k % M;
    k = k * k % M;
    n /= 2;
  }
  return res;
}
int main() {
  int N;
  bool flag = false;
  map<pair<long long, long long>, int> counter;
  map<pair<long long, long long>, bool> used;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    long long A, B;
    scanf("%lld%lld", &A, &B);
    if (A == 0 && B == 0) {
      flag = true;
      continue;
    }
    long long g = gcd(A, B);
    A /= g;
    B /= g;
    counter[{A, B}]++;
  }
  long long ans = 1;
  for (auto p : counter) {
    long long A = p.first.first;
    long long B = p.first.second;
    if (used[{A, B}]) continue;
    long long x = counter[{A, B}] + counter[{-A, -B}];
    long long y = counter[{B, -A}] + counter[{-B, A}];
    used[{A, B}] = true;
    used[{-A, -B}] = true;
    used[{B, -A}] = true;
    used[{-B, A}] = true;
    long long z =
        (power(2, x, 1000000007) + power(2, y, 1000000007) - 1) % 1000000007;
    ans = z * ans % 1000000007;
    ;
    ;
  }
  printf("%lld\n", (ans + 1000000007 - 1 + flag) % 1000000007);
  return 0;
}
