#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) {
    swap(a, b);
  }
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return 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() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  long long mod = pow(10, 9) + 7;
  map<long long, map<long long, long long> > x;
  map<long long, map<long long, bool> > c;
  vector<pair<long long, long long> > ab(N);
  long long a = 0;
  long long b = 0;
  long long k = 0;
  for (int i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      k++;
    } else if (A == 0) {
      a++;
    } else if (B == 0) {
      b++;
    } else {
      if (A < 0) {
        A = -A;
        B = -B;
      }
      long long y = gcd(A, B);
      A /= y;
      B /= y;
      x[A][B]++;
    }
    ab[i] = make_pair(A, B);
  }
  long long ans = modpow(2, a, mod) + modpow(2, b, mod) - 1LL;
  ans %= mod;
  for (int i = 0; i < N; i++) {
    long long A = ab[i].first;
    long long B = ab[i].second;
    if (A == 0 || B == 0) continue;
    if (c[A][B]) continue;
    c[A][B] = true;
    c[-B][A] = true;
    c[B][-A] = true;
    long long f = modpow(2, x[A][B], mod);
    f %= mod;
    long long b = modpow(2, x[-B][A], mod) + modpow(2, x[B][-A], mod) - 1LL;
    b %= mod;
    ans *= (f + b - 1LL) % mod;
    ans %= mod;
  }
  ans += k;
  ans %= mod;
  cout << ans - 1LL << endl;
}
