#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, int> a;
map<pair<long long, long long>, int> b;
long long c;
long long d;
long long e;
int n;
const long long mod = 1e9 + 7;
long long ans = 1;
long long f(long long a, long long x) {
  long long res = 1;
  while (x > 0) {
    if (x & 1) res = res * a % mod;
    a = a * a % mod;
    x >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      e++;
    } else if (A == 0) {
      c++;
    } else if (B == 0) {
      d++;
    } else if (A > 0 && B > 0) {
      long long h = gcd(A, B);
      a[pair<long long, long long>(A / h, B / h)]++;
    } else if (A < 0 && B < 0) {
      A = -A;
      B = -B;
      long long h = gcd(A, B);
      a[pair<long long, long long>(A / h, B / h)]++;
    } else {
      if (A < 0) A = -A;
      if (B < 0) B = -B;
      long long h = gcd(A, B);
      b[pair<long long, long long>(A / h, B / h)]++;
    }
  }
  for (auto itr = a.begin(); itr != a.end(); ++itr) {
    long long x = itr->first.first;
    long long y = itr->first.second;
    long long z = itr->second;
    long long R =
        (f(2, z) + f(2, b[pair<long long, long long>(y, x)]) - 1) % mod;
    ans = ans * R % mod;
  }
  for (auto itr = b.begin(); itr != b.end(); ++itr) {
    if (a[pair<long long, long long>(itr->first.second, itr->first.first)] ==
        0) {
      ans = ans * 2 % mod;
    }
  }
  long long tmp = (f(2, c) + f(2, d) - 1) % mod;
  ans = ans * tmp % mod;
  ans = (ans + e) % mod;
  cout << (ans - 1 + mod) % mod << endl;
}
