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


int A[100005],B[100005];

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

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;
	for(int i=1;i<=n;i++){
		cin>>A[i]>>B[i];
		if(!(A[i]&&B[i])){
			zeros++;
		}
		else {
			int g = __gcd(abs(A[i]),abs(B[i]));
			int sgn = (A[i]>0) == (B[i]>0);
			if(B[i]<0){
				A[i]*=-1;
				B[i]*=-1;
			}
			sgn = (sgn?sgn:-1);
			f[{sgn*(abs(A[i])/g),abs(B[i])/g}]++;
		}
	}
	int d = 0;
	for(int i=1;i<=n;i++){
		if(!(A[i]&&B[i])){
			continue;
		}
		else {
			int g = __gcd(abs(A[i]),abs(B[i]));
			int sgn = (A[i]>0) == (B[i]>0);
			sgn = (sgn?sgn:-1);
			int x = sgn*(abs(A[i]))/g;
			int y = abs(B[i])/g;
			int t1 = f[{x,y}];
			int t2 = f[{-y,abs(x)}];
			//cout<<x<<" "<<y<<" "<<t1<<"\n"<<-y<<" "<<abs(x)<<" "<<t2<<"\n";
			if(t1 && t2 && x!=-y){
				d += t1 + t2;
				ans *= pw(2,t1)+pw(2,t2)-1;
				ans %= mod;
				//cout<<ans<<"\n";
				f[{x,y}]=0;
				f[{-y,x*sgn}]=0;
			}
		}
	}
	ans *= pw(2,n-d-zeros);
	ans %= mod;
	ans--;
	ans += (zeros*(zeros-1))/2;
	ans += mod;
	ans %= mod;
	cout<<ans;
}
