#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
const int MAXN=200005;
long long a[MAXN],b[MAXN];
map<pair<long long,long long>,long long>mp;
set<pair<long long,long long> >vis;
long long fac[MAXN],invfac[MAXN],inv[MAXN];
int n;
void init(int n)
{
    invfac[0]=1;
    fac[0]=1;
    inv[1]=1;
    for(int i=2;i<=n;++i) inv[i]=((mod-mod/i)*inv[mod%i])%mod;
    for(int i=1;i<=n;++i) fac[i]=fac[i-1]*i%mod,invfac[i]=invfac[i-1]*inv[i]%mod;
}
long long C(int n,int m)
{
    return fac[n]*invfac[m]%mod*invfac[n-m]%mod;
}
long long quickpow(long long x,long long y)
{
    long long ans=1;
    while(y)
    {
        if(y&1)
        {
            ans=(x*ans)%mod;
        }
        x=(x*x)%mod;
        y>>=1;
    }
    return ans;
}
int main()
{
    scanf("%d",&n);
    init(200000);
    for(int i=1;i<=n;++i)
    {
        scanf("%lld %lld",&a[i],&b[i]);
        long long _g=abs(__gcd(a[i],b[i]));
        a[i]/=_g;
        b[i]/=_g;
        if(a[i]>=0)mp[make_pair(a[i],b[i])]++;
        else mp[make_pair(-a[i],-b[i])]++;
    }
    long long ans=1;
    for(auto &i:mp)
    {
        pair<long long,long long> nex=make_pair(-i.first.second,i.first.first);
        if(nex.first<0)
        {
            nex.first*=-1;
            nex.second*=-1;
        }
        if(vis.find(i.first)==vis.end()&&vis.find(nex)==vis.end())
        {
            long long A=i.second;
            long long B;

            map<pair<long long,long long>,long long>::iterator it=mp.find(nex);
            if(it!=mp.end())
            {
                B=it->second;
            }
            else
            {
                B=0;
            }

            ans=ans*((quickpow(2,A)+quickpow(2,B)-1)%mod);
            ans%=mod;

            vis.insert(i.first);
            vis.insert(nex);
        }
    }

    ans--;
    ans=((ans%mod)+mod)%mod;
    printf("%lld\n",ans);
    return 0;
}
