#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
long long int gcd(long long int a, long long int b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long int modpow(int b, int p) {
  long long int num = 1, power = b;
  for (int i = 0; i <= 30; i++) {
    if ((p >> i) & 1) num *= power;
    num %= MOD;
    power *= power;
    power %= MOD;
  }
  return num;
}
int main() {
  int n;
  cin >> n;
  int count = 0;
  map<pair<long long int, long long int>, int> ab;
  for (int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      count += 1;
    else {
      if (a == 0)
        b = 1;
      else if (b == 0)
        a = 1;
      else {
        long long int d = gcd(a, b);
        a /= d;
        b /= d;
        if (b < 0) {
          b *= -1;
          a *= -1;
        }
      }
      if (ab.find(make_pair(a, b)) == ab.end())
        ab[make_pair(a, b)] = 1;
      else
        ab[make_pair(a, b)] += 1;
    }
  }
  long long int ans = 1;
  set<pair<long long int, long long int>> visited;
  for (auto p : ab) {
    if (visited.find(p.first) != visited.end()) continue;
    long long int a = p.first.first;
    long long int b = p.first.second;
    int num = p.second;
    long long int c = b;
    long long int d = a;
    if (d < 0) {
      c *= -1;
      d *= -1;
    }
    c *= -1;
    int cnum = 0;
    pair<long long int, long long int> cp = make_pair(c, d);
    if (ab.find(cp) != ab.end()) cnum = ab[cp];
    long long int times = modpow(2, num) + modpow(2, cnum) - 1;
    times = (times % MOD + MOD) % MOD;
    ans *= times;
    ans %= MOD;
    visited.insert(p.first);
    visited.insert(cp);
  }
  ans = ((ans - 1 + count) % MOD + MOD) % MOD;
  cout << ans << endl;
  return 0;
}
