#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const ll mod=1000000007;
int main(void){
    ll n;cin>>n;
    map<pair<ll,ll>,ll> mp;
    ll inv0=0;
    rep(i,n){
        ll x,y;cin>>x>>y;
        ll g=gcd(x,y);
        if(x==0&&y==0){
            inv0++;
            continue;
        }
        if(y<0){
            x*=-1;y*=-1;
        }
        if(y==0&&x<0){
            x*=-1;y*=-1;
        }
        
        x/=g;y/=g;
        mp[{x,y}]++;
    }
    
    vector<ll> s(n*2+10,1);//2^n
    rep(i,n*2) s[i+1]=s[i]*2;
    ll res=1;
    for(auto& p:mp){
        ll a=p.first.first,b=p.first.second,x=p.second;
        if(x==0)continue;//すでに見られてる
        ll tmp=1;
        ll t=mp[{b,-a}];
        tmp+=s[x]-1;tmp%=mod;
        tmp+=s[t]-1;tmp%=mod;
        mp[{-b,a}]=0;mp[{b,-a}]=0;mp[{-a,-b}]=0;
        res*=tmp;
        res%=mod;
    }
    res=(res+mod-1)%mod;
    res+=inv0;
    res%=mod;
    cout<<res<<endl;
}