#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007LL;
long long INF = 1LL << 60;
long long gcd(long long a, long long b) {
  long long t;
  if (a < b) {
    t = a;
    a = b;
    b = t;
  }
  while ((t = a % b) != 0) {
    a = b;
    b = t;
  }
  return b;
}
long long D[200005];
int main() {
  ios::sync_with_stdio(false);
  int N;
  long long A, B;
  cin >> N;
  long long nZero = 0;
  long long nInf = 0;
  map<pair<long long, long long>, long long> m[2];
  set<pair<long long, long long> > st;
  for (int i = 0; i < N; i++) {
    cin >> A >> B;
    if (A == 0) {
      nZero++;
      continue;
    }
    if (B == 0) {
      nInf++;
      continue;
    }
    int s = 0;
    if (A < 0 && B < 0) {
      A = -A;
      B = -B;
    } else if (A < 0 || B < 0) {
      s = 1;
      A = (A < 0) ? -A : A;
      B = (B < 0) ? -B : B;
      swap(A, B);
    }
    long long g = gcd(A, B);
    A /= g;
    B /= g;
    pair<long long, long long> p = make_pair(A, B);
    m[s][p]++;
    st.insert(p);
  }
  D[0] = 1;
  for (int i = 1; i <= 200005; i++) {
    D[i] = (D[i - 1] * 2LL) % MOD;
  }
  long long ret = 1;
  ret *= D[nZero + nInf];
  ret %= MOD;
  ret -= (D[nZero] - 1) * (D[nInf] - 1);
  ret = (ret % MOD + MOD) % MOD;
  for (set<pair<long long, long long> >::iterator it = st.begin();
       it != st.end(); ++it) {
    long long a = m[0][*it];
    long long b = m[1][*it];
    long long c = D[a + b];
    c -= (D[a] - 1) * (D[b] - 1);
    c = (c % MOD + MOD) % MOD;
    ret = (ret * c) % MOD;
  }
  cout << (ret - 1 + MOD) % MOD << endl;
}
