#include <bits/stdc++.h>
using namespace std;
using P = pair<long, long>;
const int MOD = 1000000007;
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  long long a0 = 0;
  long long b0 = 0;
  map<pair<long long, long long>, long long> m;
  long long i;
  for (i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      continue;
    } else if (a == 0 && b != 0) {
      a0++;
    } else if (a != 0 && b == 0) {
      b0++;
    } else {
      long long g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
      if (a < 0 && b < 0) {
        a = -a;
        b = -b;
      }
      if (a < 0 && b > 0) {
        a = -a;
        b = -b;
      }
      m[{a, b}]++;
    }
  }
  map<pair<long long, long long>, long long> used;
  long long ans = 1;
  a0 = (modpow(2, a0, MOD) - 1 + MOD) % MOD;
  b0 = (modpow(2, b0, MOD) - 1 + MOD) % MOD;
  ans *= (a0 + b0 + 1) % MOD;
  for (auto pa : m) {
    long long x = pa.second;
    long long a = pa.first.first;
    long long b = pa.first.second;
    if (used[{a, b}] > 0) continue;
    if (a > 0 && b > 0) {
      used[{b, -a}] = 1;
      used[{a, b}] = 1;
    } else if (a > 0 && b < 0) {
      used[{a, b}] = 1;
      used[{-b, a}] = 1;
    }
    long long y;
    if (a > 0 && b > 0) {
      y = m[{b, -a}];
    } else if (a > 0 && b < 0) {
      y = m[{-b, a}];
    }
    x = (modpow(2, x, MOD) - 1 + MOD) % MOD;
    y = (modpow(2, y, MOD) - 1 + MOD) % MOD;
    ans *= ((x + y + 1) % MOD);
    ans %= MOD;
  }
  cout << (ans - 1 + MOD) % MOD << endl;
}
