#include <bits/stdc++.h>
using namespace std;
static const long long INF = 1e18 + 10;
static const long long MOD = 1e9 + 7;
bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
  return arg1.first > arg2.first;
}
template <class T>
void chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
}
template <class T>
void chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
}
long long gcd(long long a, long long b) {
  if (a < 0) a *= -1;
  if (b < 0) b *= -1;
  if (a < b) swap(a, b);
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
long long modpow(long long a, long long b, long long m) {
  if (b == 0) return 1LL;
  if (b % 2 == 0) {
    long long t = modpow(a, b / 2, m);
    return t * t % m;
  }
  return a * modpow(a, b - 1, m) % m;
}
int main(void) {
  long long n;
  cin >> n;
  map<pair<long long, long long>, long long> mp;
  long long a, b, g, zz = 0;
  for (int in = 0; in < n; in++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zz++;
      continue;
    } else if (a == 0 && b != 0) {
      b = 1;
    } else if (a != 0 && b == 0) {
      a = 1;
    } else if (b < 0) {
      a *= -1;
      b *= -1;
      g = gcd(a, b);
      a /= g;
      b /= g;
    } else {
      g = gcd(a, b);
      a /= g;
      b /= g;
    }
    auto judge = mp.insert({make_pair(a, b), 1});
    if (!judge.second) mp[make_pair(a, b)]++;
  }
  long long atmp, btmp, ctmp;
  long long ans = 1;
  for (auto imp : mp) {
    atmp = imp.first.first;
    btmp = imp.first.second;
    ctmp = imp.second;
    if (ctmp == 0) continue;
    if (atmp == 0) {
      if (mp[make_pair(1, 0)]) {
        ans *= modpow(2, mp[make_pair(1, 0)], MOD) +
               modpow(2, mp[make_pair(0, 1)], MOD) - 1;
        ans %= MOD;
      } else {
        ans *= modpow(2, mp[make_pair(0, 1)], MOD);
        ans %= MOD;
      }
      mp[make_pair(1, 0)] = 0;
      mp[make_pair(0, 1)] = 0;
    } else if (btmp == 0) {
      if (mp[make_pair(0, 1)]) {
        ans *= modpow(2, mp[make_pair(1, 0)], MOD) +
               modpow(2, mp[make_pair(0, 1)], MOD) - 1;
        ans %= MOD;
      } else {
        ans *= modpow(2, mp[make_pair(1, 0)], MOD);
        ans %= MOD;
      }
      mp[make_pair(1, 0)] = 0;
      mp[make_pair(0, 1)] = 0;
    } else {
      long long atmp2, btmp2;
      atmp2 = atmp;
      btmp2 = btmp;
      if (atmp2 < 0) {
        atmp2 *= -1;
        btmp2 *= -1;
      }
      if (mp[make_pair(-btmp2, atmp2)]) {
        ans *= modpow(2, mp[make_pair(atmp, btmp)], MOD) +
               modpow(2, mp[make_pair(-btmp2, atmp2)], MOD) - 1;
        ans %= MOD;
      } else {
        ans *= modpow(2, mp[make_pair(atmp, btmp)], MOD);
        ans %= MOD;
      }
      mp[make_pair(atmp, btmp)] = 0;
      mp[make_pair(-btmp2, atmp2)] = 0;
    }
  }
  ans += zz - 1;
  ans %= MOD;
  if (n == zz) {
    ans++;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
