#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1000000007;

// ref: https://github.com/atcoder-live/library/blob/master/mint.cpp
struct mint
{
  ll x;
  mint(ll x = 0) : x((x % MOD + MOD) % MOD)
  {
  }
  mint operator-() const
  {
    return mint(-x);
  }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= MOD)
      x -= MOD;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += MOD - a.x) >= MOD)
      x -= MOD;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const
  {
    return mint(*this) += a;
  }
  mint operator-(const mint a) const
  {
    return mint(*this) -= a;
  }
  mint operator*(const mint a) const
  {
    return mint(*this) *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const
  {
    return pow(MOD - 2);
  }
  mint &operator/=(const mint a)
  {
    return *this *= a.inv();
  }
  mint operator/(const mint a) const
  {
    return mint(*this) /= a;
  }
};
istream &operator>>(istream &is, const mint &a)
{
  return is >> a.x;
}
ostream &operator<<(ostream &os, const mint &a)
{
  return os << a.x;
}

int main()
{
  long long N;
  scanf("%lld", &N);
  map<pair<ll, ll>, ll> mp;
  for (int i = 0; i < N; i++)
  {
    ll A, B;
    scanf("%lld", &A);
    scanf("%lld", &B);
    if (A == 0 && B)
      B = 1;
    else if (B == 0 && A)
      A = 1;
    else if (A != 0 && B != 0)
    {
      ll t = gcd(A, B);
      A /= t, B /= t;
      if (B < 0)
        A *= -1, B *= -1;
    }
    mp[{A, B}]++;
  }
  mint sum = mint(2).pow(mp[{0, 1}]) + mint(2).pow(mp[{1, 0}]) - 1;
  set<pair<ll, ll>> st;
  for (auto &e : mp)
  {
    pair<ll, ll> p = e.first;
    if (st.count(p) || e.first == make_pair(0LL, 0LL))
      continue;
    ll a = -p.first, b = p.second;
    pair<ll, ll> pp;
    if (a < 0)
      pp = {-b, -a};
    else
      pp = {b, a};
    if (mp.count(pp))
    {
      sum *= mint(2).pow(mp[p]) + mint(2).pow(mp[pp]) - 1;
      st.insert(pp);
    }
    else
    {
      sum *= mint(2).pow(mp[p]);
    }
  }
  sum += mp[{0, 0}];
  cout << sum - 1 << endl;

  return 0;
}
