#include <bits/stdc++.h>
const long long MOD = 1000000007;
long long gcd(long long a, long long b) {
  long long r = a % b;
  return r ? gcd(b, r) : b;
}
int main() {
  int N;
  std::cin >> N;
  long long zero = 0;
  std::vector<long long> A(N), B(N);
  std::map<std::pair<long long, long long>, long long> m;
  for (int i = 0; i < N; i++) {
    long long a, b;
    std::cin >> a >> b;
    if (a == 0 && b == 0) {
      ++zero;
      continue;
    } else if (a == 0) {
      b = 1;
    } else if (b == 0) {
      a = 1;
    } else {
      long long g = gcd(std::abs(a), std::abs(b));
      a /= g;
      b /= g;
      if (b < 0) {
        a *= -1;
        b *= -1;
      }
    }
    A[i] = a;
    B[i] = b;
    m[std::make_pair(a, b)] += 1;
  }
  auto pow = [](long long a, int n) {
    long long res = 1;
    for (; n; n >>= 1) {
      if (n & 1) res = res * a % MOD;
      a = a * a % MOD;
    }
    return res;
  };
  long long ans = 1;
  for (int i = 0; i < N; i++) {
    auto p = std::make_pair(A[i], B[i]);
    if (m.count(p) == 0) continue;
    auto q =
        A[i] < 0 ? std::make_pair(B[i], -A[i]) : std::make_pair(-B[i], A[i]);
    long long x = m[p];
    long long y = m[q];
    long long res = ((pow(2, x) - 1) + (pow(2, y) - 1) + 1) % MOD;
    ans = ans * res % MOD;
    m.erase(p);
    m.erase(q);
  }
  ans = (ans + MOD + zero - 1) % MOD;
  std::cout << ans << "\n";
}
