#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair

using namespace std;

const int N=2e5+5;
const int mod=1e9+7;
int n,a[N],b[N],pw[N],zero,f[N];
map<pii,int>cnt;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    pw[0]=1;
    set<pii>val;
    for(int i=1;i<=n;i++)
    {
        pw[i]=pw[i-1]*2%mod;
        cin>>a[i]>>b[i];
        if(a[i]==0||b[i]==0)
        {
            zero++;
            continue;
        }
        int g=__gcd(abs(a[i]),abs(b[i]));
        a[i]/=g;
        b[i]/=g;
        if(b[i]<0)
        {
            a[i]=-a[i];
            b[i]=-b[i];
        }
        pii now=mp(a[i],b[i]);
        pii need=mp(-b[i],a[i]);
        if(need.se<0)
        {
            need.se=-need.se;
            need.fi=-need.fi;
        }
        if(!val.count(need)) val.insert(now);
        cnt[now]++;
    }
    int sz=val.size();
    int res=zero+1;
    for(auto&x:val)
    {
        pii cur=x;
        pii ncur=mp(-x.se,x.fi);
         if(ncur.se<0)
        {
            ncur.se*=-1;
            ncur.fi*=-1;
        }
        //cout<<cur.fi<<' '<<cur.se<<' '<<ncur.fi<<' '<<ncur.se<<'\n';
        res=res*(pw[cnt[cur]]+pw[cnt[ncur]]-1)%mod;
    }
    cout<<(res-1+mod)%mod;
}

