#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<ll, ll>;
const ll mod = 1000000007;
ll gcd(ll i, ll j) {
  if (i < 0) i = -i;
  if (j < 0) j = -j;
  if (i < j) {
    swap(i, j);
  }
  ll r = i % j, a = i, b = j;
  while (r != 0) {
    i = j;
    j = r;
    r = i % j;
  }
  return j;
}
long long modpow(long long a, long long n, ll mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  map<P, int> mp;
  int zero = 0;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    if (a == 0) {
      mp[P(0, 1)]++;
    } else if (b == 0) {
      mp[P(1, 0)]++;
    } else {
      if (a < 0) {
        a = -a;
        b = -b;
      }
      ll gcdab = gcd(a, b);
      mp[P(a / gcdab, b / gcdab)]++;
    }
  }
  ll ans = 1;
  ans *= (modpow(2, mp[P(0, 1)], mod) + modpow(2, mp[P(1, 0)], mod) - 1) % mod;
  mp[P(0, 1)] = 0;
  mp[P(1, 0)] = 0;
  ans %= mod;
  for (auto p : mp) {
    ll x = p.first.first;
    ll y = p.first.second;
    ll nx, ny;
    if (y > 0) {
      nx = y;
      ny = -x;
    } else {
      nx = -y;
      ny = x;
    }
    ans *=
        (modpow(2, mp[p.first], mod) + modpow(2, mp[P(nx, ny)], mod) - 1) % mod;
    mp[p.first] = 0;
    mp[P(nx, ny)] = 0;
    ans %= mod;
  }
  ans -= 1;
  ans += zero;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
