//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
ll power(ll a, ll b)
{
    if(b<0) return 0;
    ll res=1LL;
    while(b>0)
    {
        if(b&1LL) res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res%mod;
}
ll doo(ll x)
{
    x=(x-1+mod)%mod;
    return x;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    map<pair<ll,ll>,ll> mp;
    ll val;
    ll n; cin>>n;
    // ll ans=0;
    ll cnt=0;
    for(int i=1;i<=n;i++){
        ll a,b,x,y; cin>>a>>b;
        if(a==0 && b==0)  {cnt++; continue; }
        ll gcd=__gcd(abs(a),abs(b));
        mp[{a/gcd,b/gcd}]++;
    }
    ll ans=1LL;ll x,y;
    map<pair<ll,ll>,ll> vis;
    for(auto i: mp){
        // cout<<i.first.first<< " "<<i.first.second<<" "<<i.second<<endl;
        if(vis.count(i.first)) continue;
        ll c=0;
        ll a=i.first.first; ll b=i.first.second;
        if(a*b<0){
            pair<ll,ll> pp;
            x=abs(a); y=abs(b);
            // x/=gcd; y/=gcd;
            pp={y,x};
            vis[pp]++;
            c+=mp[pp];
            pp={-y,-x};
            c+=mp[pp];
            vis[pp]++;
            val=(power(2,c)+power(2,i.second))%mod;  // only take either side
            val=doo(val);    // subtract 1 as we subtract 2 times empty set 
            ans=(ans*val)%mod;
        }
        if(a*b>=0)
        {
            pair<ll,ll> pp;
            x=abs(a); y=abs(b);
            // x/=gcd; y/=gcd;
            pp={-y,x};
            c+=mp[pp];
            vis[pp]++;
            pp={y,-x};
            c+=mp[pp];
            vis[pp]++;
           val=(power(2,c)+power(2,i.second))%mod;
            val=doo(val);
            ans=(ans*val)%mod;
        }
        // cout<<val<<endl;
    }
    ans=doo(ans);
    ans=(ans+cnt)%mod;
    cout<<ans<<endl;
}