#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
long long gcd(long long x, long long y) {
  while (y > 0) {
    long long tmp = y;
    y = x % y;
    x = tmp;
  }
  return x;
}
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
long long PowMod(long long N, long long P, long long M) {
  long long ans = 1;
  while (P >= 1) {
    if (P % 2) ans = ans * N % M;
    N = N * N % M;
    P /= 2;
  }
  ans %= M;
  return ans;
}
int main() {
  map<pair<long long, long long>, long long> m;
  long long N;
  cin >> N;
  vector<long long> A(N), B(N);
  vector<pair<long long, long long>> d;
  map<pair<long long, long long>, bool> ok;
  long long zeros = 0, a0 = 0, b0 = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0) {
      zeros++;
      continue;
    } else if (A[i] == 0) {
      a0++;
      continue;
    } else if (B[i] == 0) {
      b0++;
      continue;
    }
    long long x = gcd(abs(A[i]), abs(B[i]));
    A[i] /= x;
    B[i] /= x;
    if (A[i] < 0) {
      A[i] *= -1;
      B[i] *= -1;
    }
    m[make_pair(A[i], B[i])]++;
    d.push_back(make_pair(A[i], B[i]));
  }
  long long ans = 1;
  for (pair<long long, long long> now : d) {
    pair<long long, long long> now2;
    if (now.second < 0) {
      now2 = make_pair(now.second * -1, now.first);
    } else {
      now2 = make_pair(now.second, now.first * -1);
    }
    if (ok[now] == false) {
      ok[now] = true;
      ok[now2] = true;
      ans *=
          (PowMod(2, m[now], 1000000007) + PowMod(2, m[now2], 1000000007) - 1);
      ans %= 1000000007;
    }
  }
  ans *= (PowMod(2, a0, 1000000007) + PowMod(2, b0, 1000000007) - 1);
  if (zeros > 0) ans += zeros;
  ans--;
  ans %= 1000000007;
  cout << ans;
  return 0;
}
