#include <bits/stdc++.h>
#define ref(i,n) for(int i=0;i<n;i++)
using namespace std;
#define mo 1000000007

typedef pair<int,int> P;
set<long double> v;
map<long double,long long> mp;

int main()
{
    int n;
    cin>>n;
    int a0=0;

    ref(i,n){
        long double x,y;
        cin>>x>>y;
        if(y==0) {a0++;continue;}
        long double z=x/y;
        if(v.find(z)!=v.end()) mp[z]++;
        else {mp[z]=1;v.insert(z);}
    }
    long long ans=1;


    auto j=v.begin();

    ref(i,v.size()){

        long double t=*j;

        if(t==0){
            if(a0){
                int y1=1,y2=1;
                ref(k,mp[0]) y1=y1*2%mo;
                ref(k,a0) y2=y2*2%mo;
                long long yy=(y1+y2-1)%mo;
                
                ans=ans*yy%mo;
                mp[0]=0;
            }
            j++
            continue;
        }
        if(v.find(-(1/t))!=v.end()){

        int y1=1,y2=1;
        ref(k,mp[t]) y1=y1*2%mo;
        ref(k,mp[-(1/t)]) y2=y2*2%mo;

        long long yy=(y1+y2-1)%mo;

            ans=ans*yy%mo;
            mp[t]=0;mp[-(1/t)]=0;

        }
    j++;
    }


    auto i=mp.begin();

    ref(k,mp.size()){
        long long xx=1;
        ref(k,i->second) xx=xx*2%mo;
        ans=ans*xx%mo;
        i++;
    }
    if(ans==0) ans+=mo;
    cout<<ans-1;
    return 0;


}
