#include <bits/stdc++.h>
using namespace std;
using p32=pair<int,int>;
using i64=int64_t;
using p64=pair<long long,long long>;

const int mod=1e9+7;

main()
{
    int n; cin>>n;
    int az=0,bz=0;
    int abz=0;
    map<p64, i64> cnt;
    for(int i=0; i<n; ++i)
    {
        i64 a,b; cin>>a>>b;
        if(!a)
        {
            if(!b)
            {
                ++abz;
            }
            ++az;
        }
        else if(!b)
        {
            ++bz;
        }
        else
        {
            i64 g=gcd(a,b);
            a/=g,b/=g;
            if(a<0) a=-a,b=-b;
            cnt[{a,b}]++;
        }
    }
    i64 pw2[1<<18]={1};
    for(int i=0; i<n; ++i)
    {
        pw2[i+1]=pw2[i]*2%mod;
    }
    i64 ans=1+abz;
    for(auto [p,c]: cnt)
    {
        if(!c) continue;
        p64 q={p.second,-p.first};
        if(q.first<0)
        {
            q.first*=-1;
            q.second*=-1;
        }
        i64 &d=cnt[q];
        ans*=(pw2[c]+pw2[d]+mod-1)%mod;
        ans%=mod;
        d=0;
    }
    cout << (ans-1+mod)%mod << "\n";
}