//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
using namespace std;

#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vector<int>>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define itr(v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fd(i,n)         for(int i=n-1;i>=0;i--)
#define fir(i,a,b)      for(int i=a;i<b;i++)
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);
#define MAXZ            200005
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

bool cmp(int a,int b) {return a>b;}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

int a[200001],b[200001];

int32_t main()
{
    FIO
    int n; cin>>n;
    int c1=0,c2=0,uni=0;
    fi(i,n){
        cin>>a[i]>>b[i];
    }
    map<pii,int> m;
    map<pii,int> m1;
    fi(i,n){
        // int lo=0;
        if(a[i]==0 || b[i]==0){
            if(a[i]==0 && b[i]==0){
                uni++;
            }
            else if(a[i]==0){
                c1++;
            }
            else{
                c2++;
            }
        }
        else{
            int f=__gcd(abs(a[i]),abs(b[i]));
            a[i]=a[i]/f;
            b[i]=b[i]/f;
            pii p(a[i],b[i]);
            m[p]++;
            m1[p]++;
        }
    }
    int tot=n;
    int ans=1;
    //  ans=(ans*(expo(2,sum,mod)+expo(2,m,mod))%mod)%mod;
    ans=(ans*(expo(2,c1,mod)+expo(2,c2,mod)-1+mod)%mod)%mod;
    itr(m){
        int x=it.first.first,y=it.first.second;
        pii p(x,y);
        if(m1.find(p)==m1.end()) continue;
        pii p1(-y,x);
        pii p2(y,-x);
        int sum=0;
        if(m1.find(p1)!=m1.end()){
            sum+=m1[p1];
        }
        if(m1.find(p2)!=m1.end()){
            sum+=m1[p2];
        }
        // cout<<x<<" "<<y<<" "<<sum<<"\n";
        ans=(ans*(expo(2,sum,mod)+expo(2,m1[p],mod)-1+mod)%mod)%mod;
        m1.erase(p);
        m1.erase(p1);
        m1.erase(p2);
    }
    ans=(ans+uni-1+mod)%mod; 
    
    // cout<<ans<<"\n";
    // ans=(ans+n-1)%mod;
    cout<<ans<<"\n";
    return 0;
}