#include <bits/stdc++.h>
using namespace std;

using ll=long long;
constexpr ll mod=1000000007;

ll myPow(ll b, ll e){
    ll res=1;
    while(e){
        if(e&1)res=res*b%mod;
        b=b*b%mod;
        e>>=1;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n;
    cin>>n;
    ll a[n],b[n];
    for(ll i=0;i<n;++i){
        cin>>a[i]>>b[i];
    }
    map<pair<ll,ll>,ll> cnt;
    for(ll i=0;i<n;++i){
        ll gcd=__gcd(a[i],b[i]);
        pair<ll,ll> p;
        if(gcd==0){
            p.first=p.second=0;
        }else{
            p.first=a[i]/gcd;
            p.second=b[i]/gcd;
        }
        cnt[p]+=1;
    }
    ll ans=1;
    for(auto it=cnt.begin();it!=cnt.end();++it){
        pair<ll,ll> p=it->first;
        if(p.first==0&&p.second==0)continue;
        pair<ll,ll> q;
        if(p.first<=0){
            q.first=p.second;
            q.second=-p.first;
        }else{
            q.first=-p.second;
            q.second=p.first;
        }
        auto itr=cnt.find(q);
        if(p.first<=0 && itr!=cnt.end())continue;
        ll a=it->second, b=(itr==cnt.end()?0:itr->second);
        ans=ans*(myPow(2,a)+myPow(2,b)+mod-1)%mod;
    }
    ans=(ans+cnt[make_pair(0LL,0LL)])%mod;
    ans+=mod-1;
    ans%=mod;
    cout<<ans<<endl;
    
    return 0;
}