#include <bits/stdc++.h>
using namespace std;
long long N;
long long A[200005];
long long B[200005];
long gcd(long a, long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
long long modpow(long long ori, long long po) {
  long long res = 1;
  while (po > 0) {
    if (po & 1) {
      res *= ori;
      res %= 1000000007;
    }
    ori *= ori;
    ori %= 1000000007;
    po >>= 1;
  }
  return res;
}
int main() {
  cin >> N;
  for (long long i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }
  map<pair<long long, long long>, long long> memo;
  long long azero = 0;
  long long bzero = 0;
  long long abzero = 0;
  long long ngpair = 0;
  for (long long i = 0; i < N; i++) {
    long long a = A[i];
    long long b = B[i];
    if (a < 0 && b < 0) {
      a = -a;
      b = -b;
    }
    long long g = gcd(a, b);
    if (a == 0 && b == 0) {
      abzero++;
      continue;
    } else if (a == 0) {
      azero++;
      continue;
    } else if (b == 0) {
      bzero++;
      continue;
    }
    a /= g;
    b /= g;
    if (memo.count(make_pair(-b, a)) > 0) {
      ngpair += memo[make_pair(-b, a)];
    }
    if (memo.count(make_pair(b, -a)) > 0) {
      ngpair += memo[make_pair(b, -a)];
    }
    memo[make_pair(a, b)]++;
  }
  long long ans = 1;
  ans *= (modpow(2, azero) - 1) + (modpow(2, bzero) - 1) + 1;
  ans = (ans + 1000000007) % 1000000007;
  set<pair<long long, long long> > done;
  for (auto item : memo) {
    long long a = item.first.first;
    long long b = item.first.second;
    long long num = item.second;
    if (done.count(make_pair(a, b)) > 0) {
      continue;
    }
    done.insert(make_pair(a, b));
    long long tmpans = 0;
    tmpans += modpow(2, num) - 1;
    long long ngpair = 0;
    if (memo.count(make_pair(-b, a)) > 0) {
      ngpair += memo[make_pair(-b, a)];
      done.insert(make_pair(-b, a));
    }
    if (memo.count(make_pair(b, -a)) > 0) {
      ngpair += memo[make_pair(b, -a)];
      done.insert(make_pair(b, -a));
    }
    tmpans += modpow(2, ngpair) - 1;
    ans *= (tmpans + 1);
    ans = (ans + 1000000007) % 1000000007;
  }
  ans--;
  ans = (ans + 1000000007) % 1000000007;
  cout << ans << endl;
}
