#include <bits/stdc++.h>
using namespace std;
long long N;
map<pair<long long, long long>, pair<long long, long long> > AA;
long long ans = 1;
long long INF = 10000000000000009;
long long gcd(long long a, long long b) {
  while (1) {
    if (a < b) swap(a, b);
    if (!b) break;
    a %= b;
  }
  return a;
}
long long M = 1000000007;
long long mpow(long long x, long long n) {
  long long anss = 1;
  while (n != 0) {
    if (n & 1) anss = anss * x % M;
    x = x * x % M;
    n = n >> 1;
  }
  return anss;
}
int main() {
  cin >> N;
  long long zeros = 0;
  for (int i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      zeros++;
      continue;
    }
    long long n = gcd(abs(A), abs(B));
    A = A / n;
    B = B / n;
    if (B < 0) {
      B = -B;
      A = -A;
    } else if (B == 0) {
      A = 1;
    }
    if (A == 0) {
      B = 1;
    }
    if (A > 0) {
      AA[pair<long long, long long>(A, B)].first += 1;
    } else {
      AA[pair<long long, long long>(B, -A)].second += 1;
    }
  }
  for (auto p : AA) {
    ans = (ans *
           (mpow(2, AA[p.first].first) + mpow(2, AA[p.first].second) - 1) % M) %
          M;
  }
  cout << (ans + zeros - 1) % M << endl;
}
