#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const int mod=1e9+7;
const int mx=2e5+77;
ll two[mx];

int main() {
	two[0]=1;
	for (int i=1; i<mx; i++)
		two[i]=(two[i-1]*2)%mod;
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N; cin>>N;
	vector<ll> A(N), B(N);
	for (int i=0; i<N; i++)
		cin>>A[i]>>B[i];
	int left=0, right=0;
	map<ii,int> ct;
	for (int i=0; i<N; i++) {
		if(A[i]==0&&B[i]==0) {
			;
		} else if(A[i]==0) left++;
		else if(B[i]==0) right++;
		else {
			if(A[i]<0 && B[i]<0) {
				A[i]=abs(A[i]), B[i]=abs(B[i]);
			} else if(A[i]>0 && B[i]>0) {
				;
			} else {
				A[i]=-abs(A[i]), B[i]=abs(B[i]);
			}
			ll G=gcd(abs(A[i]),abs(B[i]));
			ct[{A[i]/G,B[i]/G}]++;
		}
	}
	ll ret=1;
	ret=(ret*(1 + two[left]-1+two[right]-1))%mod;
//cout<<"#"<<ret<<endl;
	set<ii> done;
	for (auto it : ct) {
		ii key=it.first;
		if(done.count(key)) continue;
		ii opp={-key.second,key.first};
		if(!ct.count(opp)) opp={-opp.first, -opp.second};
//cout<<key.first<<"/"<<key.second<<"::"<<opp.first<<"/"<<opp.second<<endl;
//cout<<ct[key]<<" "<<ct[opp]<<"::"<<two[ct[key]]<<" "<<two[ct[opp]]<<"=>"<<1 + two[ct[key]]-1+two[ct[opp]]-1<<endl;
		ret=(ret*(1 + two[ct[key]]-1+two[ct[opp]]-1))%mod;
//cout<<"#"<<ret<<endl;
		done.insert(key);
		done.insert(opp);
	}
//cout<<ret<<endl;
	ret=(ret+mod-1)%mod;
	cout<<ret<<"\n";
	return 0;
}