#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;
  vector<pll>ab(n);
  rep(i, n)cin>>ab[i].first>>ab[i].second;
  ll z=0;
  map<pll, pi> m;
  rep(i, n){
    auto p=ab[i];
    if(p.first==0 && p.second==0){ z++; continue; }
    ll g = gcd(p.first, p.second);
    ll x = p.first / g, y = p.second / g;
    // rotation 180
    if(x<0 && 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){
      swap(x, y); 
      y*=-1;
    }
    if(rot90)m[{x,y}].first++;
    else m[{x,y}].second++;
  }
  ll result = modpow(2LL, (ll)n, MOD)-1;
  ll d=0;
  for(auto pp: m){
    ll l = pp.second.second, r = pp.second.first;
    l = modpow(2LL, (ll)l, MOD)-1;
//cout<<l<<','<<r<<endl;
    r =modpow(2LL, (ll)r, MOD)-1;
    ll diff = (l*r)%MOD;
    result -= diff;
    result %= MOD;
  }

  ll diff = ((modpow(2LL, (ll)z, MOD)-1) * (modpow(2LL, (ll)(n-z), MOD)-1))%MOD; 
  result = (result-diff+MOD)%MOD;
  

  cout<<result<<endl;

  return 0;
}