#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-12;
long long gcd(long long a, long long b) {
  while (b) {
    long long tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
pair<long long, long long> normalize(long long A, long long B) {
  assert(A != 0 || B != 0);
  if (A == 0) return pair<int, int>{0, 1};
  if (B == 0) return pair<int, int>{1, 0};
  if (B < 0) {
    A = -A;
    B = -B;
  }
  assert(B >= 0);
  long long g = gcd(abs(A), abs(B));
  A /= g;
  B /= g;
  return pair<long long, long long>{A, B};
}
long long MOD = 1000000007;
inline long long add_m(long long a, long long b) { return (a + b) % MOD; }
inline long long sub_m(long long a, long long b) { return (a - b + MOD) % MOD; }
inline long long mul_m(long long a, long long b) { return (a * b) % MOD; }
long long pow_m(long long a, long long b) {
  long long r = 1LL;
  while (b) {
    if (b & 1LL) r = mul_m(r, a);
    a = mul_m(a, a);
    b >>= 1;
  }
  return r;
}
int main(void) {
  int N;
  cin >> N;
  vector<long long> A(N);
  vector<long long> B(N);
  for (int i = 0; i < (N); ++i) cin >> A[i] >> B[i];
  int countAB0 = 0;
  map<pair<long long, long long>, int> countC;
  map<pair<long long, long long>, int> countR;
  for (int i = 0; i < (N); ++i) {
    if (A[i] == 0 && B[i] == 0) {
      countAB0++;
    } else {
      countC[normalize(A[i], B[i])]++;
      countR[normalize(-B[i], A[i])]++;
    }
  }
  set<pair<long long, long long> > used;
  vector<pair<int, int> > w;
  for (int i = 0; i < (N); ++i) {
    if (A[i] != B[i]) {
      pair<long long, long long> key = normalize(A[i], B[i]);
      pair<long long, long long> rkey = normalize(-B[i], A[i]);
      if (used.count(key) == 0) {
        w.push_back({countC[key], countR[key]});
        used.insert(key);
        used.insert(rkey);
      }
    }
  }
  long long ret = countAB0 + 1;
  for (int i = 0; i < (int)(w.size()); ++i) {
    long long m = pow_m(2, w[i].first);
    m = add_m(m, pow_m(2, w[i].second));
    m = sub_m(m, 1);
    ret = mul_m(ret, m);
  }
  cout << sub_m(ret, 1) << endl;
  return 0;
}
