#include <bits/stdc++.h>
#include <algorithm>

using namespace std;
typedef long long ll;
typedef pair<long long,long long> P;
#define rep(n) for(ll i=0; i<n; i++)
#define MAX_V 100001
const ll INF = 1e+9;
const ll MOD = 1000000007;

map<pair<ll,ll>, ll> I;

ll pow(ll x, ll a)
{
  if(a==0) return 1;
  ll y = pow(x, a/2);
  y *= y;
  if(a%2==1)  y *= x;
  return y;
}

// returns irreducible rational number equal to a/b
pair<ll,ll> normalize(ll a, ll b)
{
  if(b<0) return normalize(-a, -b);
  ll g = gcd(a,b);
  return make_pair(a/g, b/g);
}

int main()
{
  ll n;
  cin >> n;
  ll zero = 0;
  vector<ll> pow2(n+1);
  pow2[0] = 1;
  for (ll i = 0; i < n; i++)
  {
    pow2[i+1]  = pow2[i] * 2 % MOD;
  }
  
  for(ll i = 0; i < n; i++)
  {
    ll a,b;
    cin >> a >> b;
    P p;
    if(a==0 && b == 0){
      zero++;
      continue;
    } else if (b==0) {
      p = make_pair(1, 0);
    } else {
      p = normalize(a,b);
    }
    auto itr = I.find(p);
    if( itr != I.end()) {
      I[p]++;
    } else {
      I[p] = 1;
    }
  }



  ll ans = 1;

  for(auto itr1 = I.begin(); itr1 != I.end();)
  {
    P p = (*itr1).first;
    ll s = (*itr1).second;

    if( p.first == 0 && p.second == 1){
      p = make_pair(1,0);
    } else { 
      p = normalize(p.second, -p.first);
    }

    ll tmp;
    auto itr2 = I.find(p);
    if (itr2 != I.end()) {
      ll t = I[p];
      tmp = pow2[s] - 1 + pow2[t] % MOD;
      I.erase(p);
    } else {
      tmp = pow2[s];
    }

    ans = (ans * tmp) % MOD;
    itr1 = I.erase(itr1);
  }

  ans = ans + zero - 1 % MOD;
  cout << ans << endl;

  return 0;
}