#include<bits/stdc++.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

// x^n in mod
ll modpow(ll x, ll n, ll mod){
  if(n==0) return 1;

  if(n%2==0){
    return modpow(x*x%mod, n/2, mod) % mod;
  }else{
    return x * modpow(x, (n-1), mod) % mod;
  }
}

int main(){
  int n;cin>>n;
  ll z=0;
  map<pll, pi> m;
  rep(i, n){
    ll x,y;cin>>x>>y;
    if(x==0 && y==0){ z++; continue; }
    ll g = gcd(x, y);
    x /= g; y /= g;
    // rotation 180
    if(y<0){ x *= -1; y *= -1; }
    if(y==0 && x<0){ x *= -1; y *= -1; }
    // rotation 90 in x<0
    bool rot90 = (x<=0);
    if(rot90){
      ll tmp = x;
      x = y; y = -tmp;
//      swap(x, y); 
//      y*=-1;
    }
    if(rot90)m[{x,y}].first++;
    else m[{x,y}].second++;
  }
  ll result = 1;
  for(auto pp: m){
    ll l = pp.second.first, r = pp.second.second;
    l = modpow(2LL, (ll)l, MOD)-1;
//cout<<l<<' '<<r<<endl;
    r =modpow(2LL, (ll)r, MOD)-1;
    result *= l+r+1;
    result %= MOD;
  }

  result = (result+z)%MOD;

  cout<<result-1<<endl;

  return 0;
}