#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e6+5;
map<pll,ll> M;
void simplify(pll& p){
    ll gcd=__gcd(p.first,p.second);
    p.first/=gcd;p.second/=gcd;
    if((p.first<0&&p.second<0)||(p.first>0&&p.second<0)) {p.first=-p.first;p.second=-p.second;}
}
const ll mod=1e9+7;
inline ll power(ll a,ll b){
    ll ans=1;for(;b;b>>=1,a=a*a%mod) if(b&1) ans=ans*a%mod;return ans;
}
pll opesite(const pll& p){
    pll ans=make_pair(-p.second,p.first);
    simplify(ans);
    return ans;
}
int main() {
    int n,zero=0;cin>>n;for(int i=1;i<=n;i++) {
        ll l,r;cin>>l>>r;if(!(l|r)) {zero++;continue;}
        pll x={l,r};simplify(x);M[x]++;
    }ll ans=1;
    for(auto x=M.begin();x!=M.end();x++) {
        if(M.find(opesite((*x).first))!=M.end()){
            ans=ans*((power(2,x->second)+power(2,M[opesite(x->first)])-1)%mod)%mod;
            x->second=0;M[opesite(x->first)]=0;
        }
        else (ans*=power(2,x->second))%=mod;
    }
    cout<<(ans+zero-1)%mod<<endl;
    return 0;
}