#include <bits/stdc++.h>
using namespace std;
long long mod_pow(long long x, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main() {
  int N;
  cin >> N;
  long long A, B;
  map<pair<long long, long long>, int> m;
  for (int i = 0; i < N; i++) {
    cin >> A >> B;
    if (A == 0) {
      m[make_pair(0, 1)]++;
      m[make_pair(1, 0)]++;
      m[make_pair(1, 0)]--;
    } else if (B == 0) {
      m[make_pair(1, 0)]++;
      m[make_pair(0, 1)]++;
      m[make_pair(0, 1)]--;
    } else {
      long long G = gcd(A, B);
      A /= G;
      B /= G;
      if (A < 0) {
        A = -A;
        B = -B;
      }
      m[make_pair(A, B)]++;
      if (B < 0) {
        A = -A;
        B = -B;
      }
      m[make_pair(B, -A)]++;
      m[make_pair(B, -A)]--;
    }
  }
  long long ans = 1, MOD = 1e9 + 7;
  for (auto i : m) {
    long long a = i.first.first, b = i.first.second, c = i.second;
    if (b <= 0) continue;
    long long d = m[make_pair(b, -a)];
    long long x = 1, y = 1;
    for (int i = 0; i < c; i++) x = (x * 2) % MOD;
    for (int i = 0; i < d; i++) y = (y * 2) % MOD;
    ans = (ans * (x + y - 1)) % MOD;
  }
  cout << (ans - 1 + MOD) % MOD << "\n";
}
