#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
map<pair<ll, ll>, int> mp;
ll mod=1000000007, pr[200010];
int main(){
    int n;
    while(cin>>n){
        ll ans=1;
        ll x, y, g, tmp, x1, y1;
        pr[0]=1;
        for(int i=1; i<=n; ++i){
        	pr[i]=pr[i-1]*2;
        	pr[i]%=mod;
        }
        set<pair<ll, ll>>st;
        for(int i=1; i<=n; ++i){
            scanf("%lld%lld",&x,&y);
            g=__gcd(x, y);
            x/=g;
            y/=g;
            x1=x;
            y1=y;
        	x*=-1;
            if(x==0 && y!=0){
            	y=1;
            }
            if(y==0 && x!=0){
            	x=1;
            }
            if(x<0){
            	x*=-1;
            	y*=-1;
            }
            if(x1==0 && y1!=0){
            	y1=1;
            }
            if(y1==0 && x1!=0){
            	x1=1;
            }
            if(y1<0){
            	x1*=-1;
            	y1*=-1;
            }
            ++mp[mk(x1, y1)];
            if(st.find(mk(y, x))==st.end())
	           	st.insert(mk(x1, y1));
        }
        for(auto it:st){
        	x=it.fs;
        	y=it.sc;
            x1=x;
            y1=y;
        	x*=-1;
            if(x==0 && y!=0){
            	y=1;
            }
            if(y==0 && x!=0){
            	x=1;
            }
            if(x<0){
            	x*=-1;
            	y*=-1;
            }

            if(x1==0 && y1!=0){
            	y1=1;
            }
            if(y1==0 && x1!=0){
            	x1=1;
            }
            if(y1<0){
            	x1*=-1;
            	y1*=-1;
            }
            if(x==0 && y==0){
            	continue;
            }
            ans*=(pr[mp[mk(y, x)]]+pr[mp[mk(x1, y1)]]-1);
            ans%=mod;
        }
        ans+=mp[mk(0, 0)];
        --ans;
        ans%=mod;
        if(ans<0){
        	ans+=mod;
        }
        cout<<ans<<endl;
    }
  return 0;
}


