#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long gcd(long long a, long long b) {
  if (a < b) {
    long long temp = a + b;
    a = temp - a;
    b = temp - b;
  }
  long long c = 1;
  if (b == 0) return a;
  while (c != 0) {
    c = a % b;
    if (c == 0) return b;
    a = b;
    b = c;
  }
}
long long N;
int main() {
  cin >> N;
  vector<long long> A(N);
  vector<long long> B(N);
  map<pair<long long, long long>, pair<long long, long long>> m;
  vector<pair<long long, long long>> key;
  vector<long long> pow_2(N + 10);
  pow_2[0] = 1;
  for (int i = 0; i < N + 1; i++) {
    pow_2[i + 1] = 2 * pow_2[i];
    pow_2[i + 1] %= MOD;
  }
  int zero = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0) {
      zero++;
      continue;
    } else if (A[i] == 0)
      B[i] = -1;
    else if (B[i] == 0)
      A[i] = 1;
    else {
      long long GCD = gcd(abs(A[i]), abs(B[i]));
      A[i] /= GCD;
      B[i] /= GCD;
      if (A[i] < 0) {
        A[i] *= (long long)-1;
        B[i] *= (long long)-1;
      }
    }
    pair<long long, long long> p;
    pair<long long, long long> num;
    if (B[i] >= 0)
      p = make_pair(A[i], B[i]);
    else
      p = make_pair(-B[i], A[i]);
    if (m.count(p) == 1) {
      num = m[p];
      if (B[i] >= 0)
        num.first++;
      else
        num.second++;
      m[p] = num;
    } else {
      if (B[i] >= 0)
        num = make_pair((long long)1, (long long)0);
      else
        num = make_pair((long long)0, (long long)1);
      m.emplace(p, num);
      key.push_back(p);
    }
  }
  long long n = key.size();
  long long ans = 1;
  for (int i = 0; i < n; i++) {
    auto p = m[key[i]];
    ans *= (pow_2[p.first] + pow_2[p.second] - 1);
    ans %= MOD;
  }
  cout << ans - 1 + zero << endl;
}
