#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int n,mod=1e9+7;
P<int,int> p[200005];
map<P<int,int>,int> m;
int POW(int x,int y){
	if(!y)RE 1;
	int t=POW(x,y/2);
	t=t*t%mod;
	if(y&1)t=t*x%mod;
	RE t;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	int x,y,ans=1;
	FOR(i,1,n){
		cin>>x>>y;
		if(!x){
			if(!y){
			}else m[MP(0ll,1ll)]++;
		}else if(!y)m[MP(1ll,0ll)]++;
		else{
			int t=__gcd(x,y);
			x/=t;y/=t;
			if(x<0){
				x=-x;y=-y;
			}
			m[MP(x,y)]++;
		}
	} 
	for(auto u:m){
		int x=u.F.F,y=u.F.S,z=u.S,cnt=POW(2,z);
		if(!z)continue;
		if(x>=0&&y>=0){
			if(m.count(MP(y,-x))){
				cnt=(cnt+POW(2,m[MP(y,-x)])-1)%mod;
				m[MP(y,-x)]=0;
			}
			ans=ans*cnt%mod;
		}else{
			if(m.count(MP(-y,x))){
				cnt=(cnt+POW(2,m[MP(-y,x)])-1)%mod;
				m[MP(-y,x)]=0;
			}
			ans=ans*cnt%mod;
		} 
	}
	cout<<(ans-1+mod)%mod<<'\n';
	RE 0;
}


