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

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

long long gcd(long long m,long long n){
    if(m==0) return n;
    if(n==0) return m;
    if(n>m) return gcd(m,n%m);
    else return gcd(n,m%n);

    }

int main()
{
    int n;
    cin>>n;
    long long a0=0,aa=0,a1=0,yy;

    ref(i,n){
        long long x,y;
        cin>>x>>y;
        if(!x&&!y){aa++;continue;}
        if(y==0) {a0++;continue;}
        if(x==0) {a1++;continue;}
        if(x<0){ x=-x;y=-y;}

        if(y>0) yy=y; else yy=-y;

        P p=P(x/gcd(x,yy),y/gcd(x,yy));

        if(v.find(p)!=v.end()) mp[p]++;
        else {mp[p]=1;v.insert(p);}
    }
    long long ans=1;


    auto j=v.begin();

    ref(i,v.size()){

        P t=*j,p;
        if(t.second<0) {
            p=P(-t.second,t.first);
        }
        else p=P(t.second,-t.first);

        if(v.find(p)!=v.end()){

            long long y1=1,y2=1;

            ref(k,mp[t]) y1=y1*2%mo;
            ref(k,mp[p]) y2=y2*2%mo;

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

            ans=ans*yy%mo;
            mp[t]=0;mp[p]=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++;
    }



        long long y1=1,y2=1;

        ref(k,a0) y1=y1*2%mo;
        ref(k,a1) y2=y2*2%mo;

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

        ans=ans*ye%mo;



    ans+=aa;
    ans%=mo;
    if(ans==0) ans+=mo;
    cout<<ans-1;
    return 0;

}