#include <bits/stdc++.h>
using namespace std;
#define int long long int


int A[200005],B[200005];

map<pair<int,int>,int> f;

pair<int,int> norm(int a, int b){
	if(a==0 && b==0){
		return {0,0};
	}
	else if(b==0){
		return {1,0};
	}
	else if(a==0){
		return {0,1};
	}
	else {
		int g = __gcd(abs(a),abs(b));
		int sgn = ((a>0) == (b>0)) - ((a>0)!=(b>0));
		a/=g;
		b/=g;
		return {sgn*abs(a),abs(b)};
	}
}

pair<int,int> opp(pair<int,int> p){
	if(p.first==0 && p.second==0){
		return {-1,-1};
	}
	else if(p.first == 0 && p.second == 0){
		return {0,1};
	}
	else if(p.first == 0 && p.second == 0){
		return {1,0};
	}
	else {
		return {-p.second,abs(p.first)};
	}
}

const int mod = 1e9+7;
int pw(int b, int e){
	if(e==0){
		return 1;
	}
	if(e&1){
		int k = pw(b,e/2);
		k*=k;
		k%=mod;
		k*=b;
		k%=mod;
		return k;
	}
	else {
		int k = pw(b,e/2);
		k*=k;
		k%=mod;
		return k;
	}
}

int32_t main(){
	int n;
	cin>>n;
	int ans = 1;
	int zeros = 0;
	int d = 0;
	for(int i=1;i<=n;i++){
		cin>>A[i]>>B[i];
		if(A[i]==0 && B[i]==0){
			zeros++;
		}
		else {
			f[norm(A[i],B[i])]++;
		}
	}
	for(int i=1;i<=n;i++){
		if(A[i]==0 && B[i]==0){
			continue;
		}
		else {
			auto a1 = norm(A[i],B[i]);
			auto a2 = opp(a1);
			auto t1 = f[a1];
			auto t2 = f[a2];
			//cout<<a1.first<<" "<<a1.second<<" "<<t1<<"\n"<<
			//	  a2.first<<" "<<a2.second<<" "<<t2<<"\n";
			if(t1&&t2&& a1.first != -a1.second){
				ans *= pw(2,t1)+pw(2,t2)-1;
				ans %= mod;
				d += t1 + t2;
				f[a1]=0;
				f[a2]=0;
			//	cout<<ans<<"\n";
			}
		}
	}
	ans *= pw(2,n-d-zeros);
	ans %= mod;
	ans += mod-1;
	ans %= mod;
	cout<<(ans*max(1LL,zeros))%mod;
}
